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 & Bar">', $html); $this->assertContains('<optgroup label="Science & Fiction">', $html); }
/** * 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); }
/** * 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()); }
/** * 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()); }