Adding a Custom Form Element to an Adminhtml Form

zsaplexgv

New Member
Is there a way to add a custom form element to a Magento Adminhtml form without placing the custom element in the \[code\]lib/Varian\[/code\] folder?I've tracked down the code that's essentially a \[code\]Varian_Data_Form_Element_\[/code\] factory\[code\]public function addField($elementId, $type, $config, $after=false){ if (isset($this->_types[$type])) { $className = $this->_types[$type]; } else { $className = 'Varien_Data_Form_Element_'.ucfirst(strtolower($type)); } $element = new $className($config); $element->setId($elementId); if ($element->getRequired()) { $element->addClass('required-entry'); } $this->addElement($element, $after); return $element;}\[/code\]So, if I'm reading this correctly, I ensure that an EAV attribute's frontend returns a specific fieldType, (such as \[code\]supertextfield\[/code\]) and the system will instantiate/render a \[code\]Varien_Data_Form_Element_Supertextfield\[/code\] when displaying this attribute's editing form.This is well and good, but it means I need to include my custom form element in the \[code\]lib/Varian\[/code\] folder hierarchy. Given how module oriented Magento is, it seems like this is doing it wrong.I realize I could jank around with a custo autoloader or symlinks in the lib, but I'm primarily interested in learning if there's [*]A canonical way to add custom form elements for attributes[*]A canonical way to customize the Magento autoloader.
 
Back
Top