Author: Christian Soronellas (csoronellas@emagister.com)
Inheritance: extends Zend_Form
Example #1
0
 public function __construct($options = null)
 {
     $this->_initializePrefixes();
     $this->setDisposition(self::DISPOSITION_HORIZONTAL);
     $this->setElementDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Label', array('class' => 'control-label')), array('Wrapper')));
     parent::__construct($options);
 }
Example #2
0
 public function __construct($options = null)
 {
     $this->_initializePrefixes();
     $this->setDisposition(self::DISPOSITION_INLINE);
     $this->setElementDecorators(array(array('FieldSize'), array('ViewHelper'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('Addon')));
     parent::__construct($options);
 }
 /**
  * Class constructor override.
  *
  * @param null $options
  */
 public function __construct($options = null)
 {
     $this->_initializePrefixes();
     $decorators = array(array('FieldSize'), array('ViewHelper'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('Addon'), array('Label', array('class' => 'control-label')));
     if ($options !== null && isset($options['addDecorator'])) {
         foreach ($options['addDecorator'] as $o) {
             $decorators[] = $o;
         }
     }
     $this->setElementDecorators($decorators);
     parent::__construct($options);
 }
 public function render(Zend_View_Interface $view = null)
 {
     foreach ($this->getElements() as $element) {
         $label = $element->getLabel();
         if (!empty($label)) {
             $element->setAttrib('placeholder', $label);
         }
     }
     /**
      * Rendering.
      */
     return parent::render($view);
 }
 public function __construct($options = null)
 {
     $this->_initializePrefixes();
     $this->setDisposition(self::DISPOSITION_HORIZONTAL);
     parent::__construct($options);
     $this->setElementDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('AddonGroupBtn'), array('ElementErrors'), array('Description', array('tag' => 'span', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'col-' . $this->_getColType() . '-' . $this->_getFieldColSize())), array('Label', array('class' => 'col-' . $this->_getColType() . '-' . $this->_getLabelColSize() . ' control-label')), array('Wrapper')));
     foreach ($this->getElements() as $element) {
         if ($element instanceof Zend_Form_Element_Checkbox) {
             $decorators = $element->getDecorators();
             $htmlTagDecorator = $decorators['Zend_Form_Decorator_HtmlTag'];
             $class = $htmlTagDecorator->getOption('class');
             $htmlTagDecorator->setOption('class', "checkbox {$class}");
             $element->addDecorator($htmlTagDecorator);
         } elseif ($element instanceof Zend_Form_Element_Submit or $element instanceof Zend_Form_Element_Button or $element instanceof Zend_Form_Element_Image) {
             $decorators = $element->getDecorators();
             $htmlTagDecorator = $decorators['Zend_Form_Decorator_HtmlTag'];
             $class = $htmlTagDecorator->getOption('class');
             $htmlTagDecorator->setOption('class', "col-" . $this->_getColType() . "-offset-" . $this->_getLabelColSize() . " {$class}");
             $element->addDecorator($htmlTagDecorator);
         }
     }
     $this->_displayConsecutiveButtonsOnTheSameLine();
 }
Example #6
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     $register = new Ot_Config_Register();
     $vars = $register->getVars();
     $varsByModule = array();
     foreach ($vars as $v) {
         if (!isset($varsByModule[$v['namespace']])) {
             $varsByModule[$v['namespace']] = array();
         }
         $varsByModule[$v['namespace']][] = $v['object'];
     }
     $section = new Zend_Form_Element_Select('section', array('label' => 'Select Configuration Section:'));
     $section->setDecorators(array('ViewHelper', array(array('wrapperField' => 'HtmlTag'), array('tag' => 'div', 'class' => 'select-control')), array('Label', array('placement' => 'prepend', 'class' => 'select-label')), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'select-header'))));
     $this->addElement($section);
     $sectionOptions = array();
     foreach ($varsByModule as $key => $value) {
         $group = array();
         foreach ($value as $v) {
             //$elm = $v->getFormElement();
             $elm = $v->renderFormElement();
             $elm->setDecorators(array('ViewHelper', array('Errors', array('class' => 'help-inline')), array(array('wrapperField' => 'HtmlTag'), array('tag' => 'div', 'class' => 'fields')), array('Label', array('placement' => 'append', 'class' => 'field-label')), array('Description', array('placement' => 'append', 'tag' => 'div', 'class' => 'field-description')), array(array('empty' => 'HtmlTag'), array('placement' => 'append', 'tag' => 'div', 'class' => 'clearfix')), array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'field-group'))));
             $group[] = $elm->getName();
             $this->addElement($elm);
         }
         $sectionOptions[preg_replace('/[^a-z]/i', '', $key)] = $key;
         $this->addDisplayGroup($group, $key);
     }
     asort($sectionOptions);
     $section->setMultiOptions($sectionOptions);
     $this->setDisplayGroupDecorators(array('FormElements', 'Fieldset'));
     $this->addElement('submit', 'submit', array('buttonType' => Twitter_Bootstrap_Form_Element_Submit::BUTTON_PRIMARY, 'label' => 'Save Configuration'));
     $this->addElement('button', 'cancel', array('label' => 'form-button-cancel', 'type' => 'button'));
     $this->addDisplayGroup(array('submit', 'cancel'), 'actions', array('disableLoadDefaultDecorators' => true, 'decorators' => array('Actions')));
     return $this;
 }
 /**
  * Class constructor override.
  *
  * @param null $options
  */
 public function __construct($options = null)
 {
     $this->_initializePrefixes();
     $this->setElementDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'span', 'class' => 'help-block')), array('Label'), array('Wrapper')));
     parent::__construct($options);
 }
Example #8
0
 public function __construct($dataMessage = 'this record', $hiddenFields = null, $options = null)
 {
     $this->_dataMessage = $dataMessage;
     $this->_hiddenFields = $hiddenFields;
     parent::__construct($options);
 }
 /**
  * Class constructor override.
  *
  * @param null $options
  */
 public function __construct($options = null)
 {
     $this->setElementDecorators(array(array('FieldSize'), array('ViewHelper'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('Addon')));
     parent::__construct($options);
 }