public function getForm(array $holidayType)
 {
     if (!$this->form) {
         $hidId = new Hidden();
         $hidId->setName('calendarId');
         $cboType = new Select();
         $cboType->setName('type')->setLabel('Type')->setAttribute('class', 'form-control')->setEmptyOption('-- Choose Types --')->setValueOptions($holidayType);
         $maxYear = date('Y', time()) + 10;
         $datePicker = new DateSelect('date');
         $datePicker->setValue(new \DateTime('now'))->setShouldRenderDelimiters(false)->setMinYear(2011)->setMaxYear($maxYear)->setLabel('Date')->setDayAttributes(array('class' => 'date-control', 'id' => 'dayCombo'))->setMonthAttributes(array('class' => 'date-control', 'id' => 'monthCombo'))->setYearAttributes(array('class' => 'date-control', 'id' => 'yearCombo'));
         $txtTitle = new Text();
         $txtTitle->setName('title')->setLabel('Title')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'Title');
         $form = new Form();
         $form->setAttributes(array('class' => 'form-horizontal', 'role' => 'form'));
         $form->add($hidId);
         $form->add($cboType);
         $form->add($datePicker);
         $form->add($txtTitle);
         $this->form = $form;
     }
     return $this->form;
 }
Beispiel #2
0
 /**
  * @expectedException \Zend\Form\Exception\InvalidArgumentException
  */
 public function testThrowsOnInvalidValue()
 {
     $element = new DateSelectElement();
     $element->setValue('hello world');
 }