Checkbox.php
2 days ago
Input.php
2 days ago
MultiSelect.php
2 days ago
Radio.php
2 days ago
Select.php
2 days ago
MultiSelect.php
22 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Form\Element; |
| 6 | |
| 7 | class MultiSelect extends Select |
| 8 | { |
| 9 | public function __construct(string $name, array $options = []) |
| 10 | { |
| 11 | parent::__construct($name, $options); |
| 12 | |
| 13 | $this->set_attribute('multiple', 'multiple'); |
| 14 | } |
| 15 | |
| 16 | protected function selected($value): bool |
| 17 | { |
| 18 | return in_array($value, (array)$this->get_value(), true); |
| 19 | } |
| 20 | |
| 21 | } |
| 22 |