*/ class Mage_Eav_Model_Form_Element extends Mage_Core_Model_Abstract { /** * Prefix of model events names * * @var string */ protected $_eventPrefix = 'eav_form_element'; /** * Initialize resource model * */ protected function _construct() { $this->_init('eav/form_element'); } /** * Retrieve resource instance wrapper * * @return Mage_Eav_Model_Mysql4_Form_Element */ protected function _getResource() { return parent::_getResource(); } /** * Retrieve resource collection instance wrapper * * @return Mage_Eav_Model_Mysql4_Form_Element_Collection */ public function getCollection() { return parent::getCollection(); } /** * Validate data before save data * * @throws Mage_Core_Exception * @return Mage_Eav_Model_Form_Element */ protected function _beforeSave() { if (!$this->getTypeId()) { Mage::throwException(Mage::helper('eav')->__('Invalid form type.')); } if (!$this->getAttributeId()) { Mage::throwException(Mage::helper('eav')->__('Invalid EAV attribute.')); } return parent::_beforeSave(); } /** * Retrieve EAV Attribute instance * * @return Mage_Eav_Model_Entity_Attribute */ public function getAttribute() { if (!$this->hasData('attribute')) { $attribute = Mage::getSingleton('eav/config') ->getAttribute($this->getEntityTypeId(), $this->getAttributeId()); $this->setData('attribute', $attribute); } return $this->_getData('attribute'); } }