Lines Matching defs:options
22 * @param array $options The available options
25 public function __construct($name, $options, $label = '')
29 $this->optGroups[''] = new OptGroup(null, $options);
34 * Add an `<optgroup>` and respective options
37 * @param array $options
41 public function addOptGroup($label, $options)
46 $this->optGroups[$label] = new OptGroup($label, $options);
55 * * the value being an array of options as defined in @param null|array $optGroups
57 * @see OptGroup::options()
66 throw new \InvalidArgumentException(hsc('Argument must be an associative array of label => [options]!'));
69 foreach ($optGroups as $label => $options) {
70 $this->addOptGroup($label, $options);
76 * Get or set the options of the Dropdown
88 * @param null|array $options
91 public function options($options = null)
93 if ($options === null) {
94 return $this->optGroups['']->options();
96 $this->optGroups[''] = new OptGroup(null, $options);
103 * When setting a value that is not defined in the options, the value is ignored
137 $options = $this->options();
138 if (!empty($options)) {
139 $keys = array_keys($options);
143 $options = $optGroup->options();
144 if (!empty($options)) {
145 $keys = array_keys($options);
154 * Set the value in the OptGroups, including the optgroup for the options without optgroup.