Decorate an element by using a view helper to render it. Accepts the following options: - separator: string with which to separate passed in content and generated content - placement: whether to append or prepend the generated content to the passed in content - helper: the name of the view helper to use Assumes the view helper accepts three parameters, the name, value, and optional attributes; these will be provided by the element.
Inheritance: extends Zend_Form_Decorator_Abstract
コード例 #1
0
ファイル: RadioPlus.php プロジェクト: smalyshev/chgk-teams
 public function render($content)
 {
     $element = $this->getElement();
     $view = $element->getView();
     $helper = $this->getHelper();
     $helperObject = $view->getHelper($helper);
     //  var_dump($element);
     $helperObject->setForm($view->form);
     return parent::render($content);
 }
コード例 #2
0
 /**
  * Get element attributes
  *
  * @return array
  */
 public function getElementAttribs()
 {
     if (null === $this->_attribs) {
         $this->_attribs = parent::getElementAttribs();
         if (array_key_exists('dijitParams', $this->_attribs)) {
             $this->setDijitParams($this->_attribs['dijitParams']);
             unset($this->_attribs['dijitParams']);
         }
     }
     return $this->_attribs;
 }
コード例 #3
0
 /**
  * Retrieve element attributes
  *
  * Set id to element name and/or array item.
  *
  * @return array
  */
 public function getElementAttribs()
 {
     $attribs = parent::getElementAttribs();
     unset($attribs['addon_append']);
     // Twitter_Bootstrap3_Form_Decorator_Addon
     unset($attribs['addon_prepend']);
     // Twitter_Bootstrap3_Form_Decorator_Addon
     unset($attribs['success']);
     // Twitter_Bootstrap3_Form_Decorator_Container
     unset($attribs['warning']);
     // Twitter_Bootstrap3_Form_Decorator_Container
     return $attribs;
 }
コード例 #4
0
 /**
  * Retrieve element attributes
  *
  * Set id to element name and/or array item.
  *
  * @return array
  */
 public function getElementAttribs()
 {
     $attribs = parent::getElementAttribs();
     $element = $this->getElement();
     if ($element->isRequired()) {
         $element->setAttrib('required', 'required');
         $element->setAttrib('aria-required', 'true');
         $attribs['required'] = 'required';
         $attribs['aria-required'] = 'true';
     }
     if ($element->hasErrors()) {
         $element->setAttrib('aria-invalid', 'true');
         $attribs['aria-invalid'] = 'true';
     }
     return $attribs;
 }
コード例 #5
0
 /**
  * Retrieve element attributes
  *
  * Set id to element name and/or array item.
  *
  * @return array
  */
 public function getElementAttribs()
 {
     $attribs = parent::getElementAttribs();
     unset($attribs['addon_append']);
     // Twitter_Bootstrap3_Form_Decorator_Addon
     unset($attribs['addon_prepend']);
     // Twitter_Bootstrap3_Form_Decorator_Addon
     unset($attribs['success']);
     // Twitter_Bootstrap3_Form_Decorator_Container
     unset($attribs['warning']);
     // Twitter_Bootstrap3_Form_Decorator_Container
     //Remove dimensions if any
     unset($attribs['dimensionLabel']);
     unset($attribs['dimensionControls']);
     unset($attribs['dimension']);
     unset($attribs['formgroupclass']);
     return $attribs;
 }
コード例 #6
0
ファイル: ViewHelper.php プロジェクト: alexukua/opus4
 public function getHelper()
 {
     if ($this->isViewOnlyEnabled()) {
         $element = $this->getElement();
         if (method_exists($element, 'getStaticViewHelper')) {
             $helper = $element->getStaticViewHelper();
         } else {
             $type = $element->getType();
             if ($pos = strrpos($type, '_')) {
                 $type = substr($type, $pos + 1);
             }
             $helper = 'viewForm' . ucfirst($type);
             try {
                 $element->getView()->getHelper($helper);
             } catch (Zend_Loader_PluginLoader_Exception $zlpe) {
                 $helper = 'viewFormDefault';
             }
         }
         $this->setHelper($helper);
         return $this->_helper;
     } else {
         return parent::getHelper();
     }
 }
コード例 #7
0
ファイル: Reset.php プロジェクト: getJv/ModuleTeste
 public function render($content)
 {
     $this->getElement()->setValue('');
     return parent::render($content);
 }
コード例 #8
0
 /**
  * @param $button
  * @return string
  */
 protected function renderButton($button)
 {
     $name = $button->getName();
     $elementId = $button->getId();
     $decorator = new Zend_Form_Decorator_ViewHelper();
     $decorator->setElement($button);
     $markup = "<span class=\"data-wrapper {$name}-data\">" . "<span class=\"field\" id=\"{$elementId}-element\">" . $decorator->render(null) . '</span></span>';
     return $markup;
 }
コード例 #9
0
ファイル: Table.php プロジェクト: GemsTracker/MUtil
 /**
  * Set a single option
  *
  * @param  string $key
  * @param  mixed $value
  * @return \Zend_Form_Decorator_Interface
  */
 public function setOption($key, $value)
 {
     switch ($key) {
         case 'cellDecorator':
             $value = $this->getCellDecorators() + array($value);
         case 'cellDecorators':
             $this->_cellDecorators = $value;
             break;
         default:
             parent::setOption($key, $value);
             break;
     }
     return $this;
 }
コード例 #10
0
ファイル: RadioViewHelper.php プロジェクト: jager/cms
 public function render($content)
 {
     $elementContent = parent::render($content);
     return "<div class='radios'>{$elementContent}</div>";
 }
コード例 #11
0
ファイル: Divctr.php プロジェクト: DivanteLtd/Zendformbuilder
 public function buildInput($content)
 {
     $dec = new Zend_Form_Decorator_ViewHelper();
     $dec->setElement($this->getElement());
     return $dec->render($content);
 }