1 | <?php |
||
5 | class SelectFilterConfig extends FilterConfig |
||
6 | { |
||
7 | protected $template = '*.select'; |
||
8 | |||
9 | protected $options = []; |
||
10 | |||
11 | protected $is_submitted_on_change = false; |
||
12 | |||
13 | protected $size = null; |
||
14 | |||
15 | protected $multipleMode = false; |
||
16 | |||
17 | /** |
||
18 | * Returns option items of html select tag. |
||
19 | * |
||
20 | * @return array |
||
21 | */ |
||
22 | public function getOptions() |
||
26 | |||
27 | /** |
||
28 | * Sets option items for html select tag. |
||
29 | * |
||
30 | * @param array $options |
||
31 | * |
||
32 | * @return $this |
||
33 | */ |
||
34 | public function setOptions(array $options) |
||
35 | { |
||
36 | $this->options = $options; |
||
37 | |||
38 | return $this; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Returns true if form must be submitted immediately |
||
43 | * when filter value selected. |
||
44 | * |
||
45 | * @return bool |
||
46 | */ |
||
47 | public function isSubmittedOnChange() |
||
51 | |||
52 | /** |
||
53 | * Allows to submit form immediately when filter value selected. |
||
54 | * |
||
55 | * @param bool $isSubmittedOnChange |
||
56 | * |
||
57 | * @return $this |
||
58 | */ |
||
59 | public function setSubmittedOnChange($isSubmittedOnChange) |
||
60 | { |
||
61 | $this->is_submitted_on_change = $isSubmittedOnChange; |
||
62 | |||
63 | return $this; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Sets the size of the select element. |
||
68 | * |
||
69 | * @param int $size |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function setSize($size) |
||
74 | { |
||
75 | $this->size = $size; |
||
76 | |||
77 | return $this; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Returns the size of the select element. |
||
82 | * |
||
83 | * @return int |
||
84 | */ |
||
85 | public function getSize() |
||
89 | |||
90 | /** |
||
91 | * Enabled multiple mode. |
||
92 | * This will switch the selected operator to IN, as any other operator does not work with multiple selections. |
||
93 | * |
||
94 | * @param $multipleMode |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function setMultipleMode($multipleMode) |
||
99 | { |
||
100 | $this->multipleMode = $multipleMode; |
||
101 | |||
102 | if ($multipleMode) { |
||
103 | $this->operator = FilterConfig::OPERATOR_IN; |
||
104 | } |
||
105 | |||
106 | return $this; |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * Returns true if the multiple mode is enabled. |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | public function isMultipleMode() |
||
118 | } |
||
119 |