addElement('hidden', 'sorter', array('class' => 'sorter')); if (App_Admin_Auth::getInstance()->getSuMode()) { $this->addElement( 'checkbox', 'allowDelete', array( 'label' => 'Allow Delete', 'checkedValue' => 'y', 'uncheckedValue' => 'n', 'disabled' => 'disabled', 'decorators' => array( array('decorator' => 'ViewHelper'), array('decorator' => 'Label', 'options' => array('placement' => 'APPEND')), 'DtDdWrapper' ) ) ); } } public function getMode() { if (null == $this->_mode) { $this->_mode = 'edit'; } return $this->_mode; } public function setMode($mode) { $this->_mode = $mode; } public function setType($type) { $this->_type = $type; } public function setItemId($id) { $this->_itemId = $id; } public function getItemId() { return $this->_itemId; } public function setGroupName($name) { $this->_groupName = $name; } public function getGroupName() { return $this->_groupName; } public function getActions() { return $this->_actions; } public function getActionTitle($action) { if (!in_array($action, $this->_actions)) { throw new Zend_Form_Exception(sprintf('"%s" is an invalid Cms Item action', $action)); } if (!isset($this->_actionTitles[$action])) { $this->_actionTitles[$action] = ucfirst($action); } return $this->_actionTitles[$action]; } public function loadDefaultDecorators() { if ($this->loadDefaultDecoratorsIsDisabled()) { return; } $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('FormElements') ->addDecorator('HtmlTag', array('tag' => 'dl')) ->addDecorator('Fieldset', array('class' => 'cms_item')); } } public function initRender() { parent::initRender(); $mode = $this->getMode(); switch ($mode) { case 'edit': case 'view': $this->getDecorator('HtmlTag')->setOption('class', $mode); break; default: break; } return $this; } }