$element = new Varien_Data_Form_Element_Text( ['name' => 'test_field', 'label' => 'Test Field'] ); $element->setValue('some value'); // Generate HTML for the element $html = $element->getElementHtml(); echo $html; // Output:
$element = new Varien_Data_Form_Element_Select( ['name' => 'test_field', 'label' => 'Test Field'] ); $element->setValues(['option1' => 'Option 1', 'option2' => 'Option 2']); $element->setValue('option2'); // Generate HTML for the element $html = $element->getElementHtml(); echo $html; // Output:This example creates a select input form element with a label, options and a default selected value. getElementHtml method generates HTML code for this element. The package for this library is Magento_Core.