Пример #1
0
 public function init()
 {
     $element = new ZendX_JQuery_Form_Element_ColorPicker('color', array('decorators' => array('UiWidgetElement'), 'validators' => array(array('Regex', false, array('/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/')))));
     $element->setValue('#000000');
     $this->addElement($element);
     $this->addElement('text', 'text', array('filters' => array('StringTrim', 'HtmlEntities'), 'validators' => array(array('StringLength', true, array(3, 50)), array('Db_NoRecordExists', true, array('adapter' => Zend_Registry::get('Default_DiContainer')->getLabelMapper()->getReadAdapter(), 'table' => Zend_Registry::get('Default_DiContainer')->getLabelMapper()->getTableName(), 'field' => 'text'))), 'decorators' => array('ViewHelper', new Zend_Form_Decorator_HtmlTag(array('tag' => 'label', 'id' => 'newLabel'))), 'required' => true, 'label' => $this->translate('label_name')));
     $this->addElement('button', 'submit', array('required' => false, 'ignore' => true, 'decorators' => array('ViewHelper'), 'type' => 'submit', 'escape' => false));
     $this->setDecorators(array('FormElements', 'Form'));
 }
Пример #2
0
 public function testElementsHaveUiWidgetDecorator()
 {
     $spinner = new ZendX_JQuery_Form_Element_Spinner('spinnerElem');
     $this->assertTrue($spinner->getDecorator('UiWidgetElement') !== false);
     $slider = new ZendX_JQuery_Form_Element_Slider('sliderElem');
     $this->assertTrue($slider->getDecorator('UiWidgetElement') !== false);
     $cp = new ZendX_JQuery_Form_Element_ColorPicker('cpElem');
     $this->assertTrue($cp->getDecorator('UiWidgetElement') !== false);
     $dp = new ZendX_JQuery_Form_Element_DatePicker('dpElem');
     $this->assertTrue($dp->getDecorator('UiWidgetElement') !== false);
     $ac = new ZendX_JQuery_Form_Element_AutoComplete('acElem');
     $this->assertTrue($ac->getDecorator('UiWidgetElement') !== false);
 }
 /**
  * Load default decorators
  *
  * @return \Zend_Form_Element
  */
 public function loadDefaultDecorators()
 {
     if (\MUtil_Bootstrap::enabled() === true) {
         $this->addDecorator('UiWidgetElement')->addDecorator('Errors')->addDecorator('Description', array('tag' => 'p', 'class' => 'help-block'))->addDecorator('HtmlTag', array('tag' => 'div', 'id' => array('callback' => array(get_class($this), 'resolveElementId')), 'class' => 'element-container'))->addDecorator('Label')->addDecorator('BootstrapRow');
     } else {
         parent::loadDefaultDecorators();
     }
     return $this;
 }