1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
22:
23: namespace picon;
24:
25: 26: 27: 28: 29: 30:
31: class DropDown extends AbstractSingleChoice
32: {
33: public function __construct($id, $choices, ChoiceRenderer $choiceRenderer = null, Model $model = null, $disabled = null)
34: {
35: parent::__construct($id, $choices, $choiceRenderer, $model, $disabled);
36: }
37:
38: protected function onComponentTag(ComponentTag $tag)
39: {
40: $this->checkComponentTag($tag, 'select');
41: $tag->setTagType(new XmlTagType(XmlTagType::OPEN));
42: parent::onComponentTag($tag);
43: }
44:
45: protected function onComponentTagBody(ComponentTag $tag)
46: {
47: $value = $this->getValue();
48: if($this->isRequired() && empty($value) || !$this->isRequired())
49: {
50: $this->renderOption($this->getDefaultValue(), null, empty($value));
51: }
52:
53: $this->renderOptions();
54: }
55:
56: protected function getDefaultValue()
57: {
58: return $this->getLocalizer()->getString('default');
59: }
60:
61: protected function supportNestedArray()
62: {
63: return true;
64: }
65: }
66:
67: ?>
68: