Exemplo n.º 1
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->addElementPrefixPath('PP_Decorator', 'PP/Decorator/', 'decorator');
     $fieldset = new Zend_Form_Decorator_Fieldset();
     if (isset($options['legend'])) {
         $fieldset->setLegend($options['legend']);
     }
     $this->setDecorators(array('FormElements', $fieldset, 'Form'));
     if (isset($options['name'])) {
         $this->setName($options['name']);
     }
 }
 public function getLegend()
 {
     $legend = parent::getLegend();
     $element = $this->getElement();
     $view = $element->getView();
     $buttons = $this->getLegendButtons();
     if (!is_null($buttons) && !is_array($buttons)) {
         $buttons = array($buttons);
     }
     $markup = '';
     if (!is_null($buttons) && count($buttons) >= 1) {
         $markup .= '<span class="button-group">';
         foreach ($buttons as $button) {
             $button = $element->getElement($button);
             if (!is_null($button)) {
                 $markup .= $this->renderButton($button);
             }
         }
         $markup .= '</span>';
     }
     return $legend . $markup;
 }