public function init() { // Parse module name from class if (!$this->_moduleName) { $this->_moduleName = substr(get_class($this), 0, strpos(get_class($this), '_')); } // Try to set item type to module name (usually an item type) if (!$this->_fieldType) { $this->_fieldType = Engine_Api::deflect($this->_moduleName); } if (!$this->_fieldType || !$this->_moduleName || !Engine_APi::_()->hasItemType($this->_fieldType)) { throw new Fields_Model_Exception('Invalid fieldType or modulePath'); } $this->view->fieldType = $this->_fieldType; // Hack up the view paths $this->view->addHelperPath(dirname(dirname(__FILE__)) . '/views/helpers', 'Fields_View_Helper'); $this->view->addScriptPath(dirname(dirname(__FILE__)) . '/views/scripts'); $this->view->addHelperPath(dirname(dirname(dirname(__FILE__))) . DS . $this->_moduleName . '/views/helpers', $this->_moduleName . '_View_Helper'); $this->view->addScriptPath(dirname(dirname(dirname(__FILE__))) . DS . $this->_moduleName . '/views/scripts'); }