Пример #1
0
 public function __construct($name = null, $options = array())
 {
     parent::__construct(isset($name) ? $name : 'personal');
     $id_hidden = new Element\Hidden('id');
     $id_hidden->setName('id');
     $firstname_text = new Element\Text('firstname');
     $firstname_text->setLabel('First name');
     $firstname_text->setLabelAttributes(array('class' => 'type_text'));
     $firstname_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...'));
     $lastname_text = new Element\Text('lastname');
     $lastname_text->setLabel('Last name');
     $lastname_text->setLabelAttributes(array('class' => 'type_text'));
     $lastname_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => true));
     $country_select = new Element\Select('country_id');
     $country_select->setLabel('Country');
     $country_select->setLabelAttributes(array('class' => 'select f_3_w50'));
     $country_select->setAttributes(array('class' => 'sel_chosen'));
     $country_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your country'));
     $state_select = new Element\Select('state_id');
     $state_select->setLabel('Province/State');
     $state_select->setLabelAttributes(array('class' => 'select f_3_w50'));
     $state_select->setAttributes(array('class' => 'sel_chosen', 'required' => true));
     $state_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your state'));
     $city_select = new Element\Select('city_id');
     $city_select->setLabel('City');
     $city_select->setLabelAttributes(array('class' => 'select f_3_w50'));
     $city_select->setAttributes(array('class' => 'sel_chosen', 'required' => true));
     $city_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your city'));
     $adress_text = new Element\Text('adress');
     $adress_text->setLabel('Adress');
     $adress_text->setLabelAttributes(array('class' => 'type_text'));
     $adress_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type adress in format (наш формат)'));
     $languages_select = new Element\Select('languages');
     $languages_select->setLabel('Languages');
     $languages_select->setLabelAttributes(array('class' => 'select', 'style' => 'float:left;'));
     $languages_select->setAttributes(array('class' => 'sel_chosen', 'multiple' => 'multiple', 'required' => true));
     $languages_select->setOptions(array('disable_inarray_validator' => true));
     $logo = new Element\Image('logo');
     $logo->setAttributes(array('src', '/images/11.jpg', 'style' => 'float:left;'));
     $file = new Element\File('file');
     $file->setLabelAttributes(array('style' => 'float:left;clear:both'));
     $this->add($id_hidden);
     $this->add($firstname_text);
     $this->add($lastname_text);
     $this->add($country_select);
     $this->add($state_select);
     $this->add($city_select);
     $this->add($adress_text);
     $this->add($languages_select);
     $this->add($logo);
     $this->add($file);
 }
Пример #2
0
 /**
  * @group ZF-2714
  */
 public function testImageElementAttributesPassedWithDecoratorOptionsToViewHelper()
 {
     $element = new ImageElement('foo');
     $element->setValue('foobar')->setAttrib('onClick', 'foo()')->setAttrib('id', 'foo-element')->setView($this->getView());
     $this->decorator->setElement($element)->setOption('class', 'imageclass');
     $image = $this->decorator->render('');
     $this->assertContains('class="imageclass"', $image);
     $this->assertContains('onClick="foo()"', $image);
     $this->assertContains('id="foo-element"', $image);
 }