예제 #1
0
 function testGetHtmlEscapesOptgroupLabel()
 {
     $field = new ListField('test');
     $field->setOptions(array('opt 1', 'opt 2'), 'Foo & Bar');
     $field->setOptions(array('opt 3', 'opt 4'), 'Science & Fiction');
     $html = $field->getHtml();
     $this->assertContains('<optgroup label="Foo &amp; Bar">', $html);
     $this->assertContains('<optgroup label="Science &amp; Fiction">', $html);
 }
예제 #2
0
 /**
  * Initializes this field, fetches the continents and sets them to this field
  * @return null
  */
 protected function init()
 {
     parent::init();
     $continentModel = ModelManager::getInstance()->getModel(ContinentModel::NAME);
     $continents = $continentModel->getDataList();
     $this->setOptions($continents);
 }
예제 #3
0
 /**
  * Initialize this field by setting the available locales as options
  * @return null
  */
 protected function init()
 {
     parent::init();
     $locales = I18n::getInstance()->getAllLocales();
     $this->setOptions($locales);
     $this->setValueDecorator(new LocaleCodeDecorator());
 }
예제 #4
0
 /**
  * Initializes this field, fetches the countries and sets them to this field
  * @return null
  */
 protected function init()
 {
     parent::init();
     $model = ModelManager::getInstance()->getModel(ContinentModel::NAME);
     $continents = $model->getContinents(1);
     foreach ($continents as $continent) {
         $this->setOptions($continent->countries, $continent->name);
     }
     $this->setKeyDecorator(new IdDecorator());
     $this->setValueDecorator(new CountryNameDecorator());
 }