Magento Certified Developer GuideCategory: 6. AdminhtmlHow can you render an element with a custom template
Manish Prakash Staff asked 5 years ago

We can provide a custom template for an element by creating our own custom form element and then overriding the getElementHtml() where we can put our own html code. A good example is the “Varien_Data_Form_Element_Gallery” class.

To add a custom field

$fieldset->addType('custom','custom/module_form_element_type');
$fieldset->addField('code', 'custom',
            array(
                'name'      => 'code',
                'label'     => Mage::helper('tax')->__('Name'),
                'class'     => 'required-entry',
                'required'  => true,
            )
        );