1 | <?php |
||
12 | abstract class cfg_fields |
||
13 | { |
||
14 | /** @var \phpbb\language\language */ |
||
15 | protected $translator; |
||
16 | |||
17 | /** |
||
18 | * Constructor |
||
19 | * |
||
20 | * @param \phpbb\language\language $translator Language object |
||
21 | */ |
||
22 | 55 | public function __construct(\phpbb\language\language $translator) |
|
23 | { |
||
24 | 55 | $this->translator = $translator; |
|
25 | 55 | } |
|
26 | |||
27 | /** |
||
28 | * Used to add a select drop down in blocks config |
||
29 | * |
||
30 | * @param array $option_ary |
||
31 | * @param $selected_items |
||
32 | * @param $key |
||
33 | * @return string |
||
34 | */ |
||
35 | 3 | public function build_select($option_ary, $selected_item, $key) |
|
47 | |||
48 | /** |
||
49 | * Used to add multi-select drop down in blocks config |
||
50 | * |
||
51 | * @param array $option_ary |
||
52 | * @param mixed $selected_items |
||
53 | * @param string $field |
||
54 | * @return string |
||
55 | */ |
||
56 | 3 | public function build_multi_select(array $option_ary, $selected_items, $field) |
|
70 | |||
71 | /** |
||
72 | * Used to build multi-column checkboxes for blocks config |
||
73 | * |
||
74 | * if multi-dimensional array, we break the checkboxes into columns ex. |
||
75 | * array( |
||
76 | * 'news' => array( |
||
77 | * 'field1' => 'Label 1', |
||
78 | * 'field2' => 'Label 2', |
||
79 | * ), |
||
80 | * 'articles' => array( |
||
81 | * 'field1' => 'Label 1', |
||
82 | * 'field2' => 'Label 2', |
||
83 | * ), |
||
84 | * ) |
||
85 | * @param array $option_ary |
||
86 | * @param mixed $selected_items |
||
87 | * @param string $field |
||
88 | * @return string |
||
89 | */ |
||
90 | 4 | public function build_checkbox(array $option_ary, $selected_items, $field) |
|
106 | |||
107 | /** |
||
108 | * Build radio buttons other than yes_no/enable_disable in blocks config |
||
109 | * |
||
110 | * @param array $option_ary |
||
111 | * @param mixed $selected_item |
||
112 | * @param string $key |
||
113 | * @return string |
||
114 | */ |
||
115 | 3 | public function build_radio(array $option_ary, $selected_item, $key) |
|
128 | |||
129 | /** |
||
130 | * Force array |
||
131 | * |
||
132 | * @param mixed $items |
||
133 | * @return array |
||
134 | */ |
||
135 | 14 | protected function ensure_array($items) |
|
139 | |||
140 | /** |
||
141 | * Force multi dimensional array |
||
142 | * |
||
143 | * @param mixed $options |
||
144 | * @param string $css_class |
||
145 | * @return array |
||
146 | */ |
||
147 | 4 | protected function ensure_multi_array($options, &$css_class) |
|
157 | |||
158 | /** |
||
159 | * @param string $needle |
||
160 | * @param array $haystack |
||
161 | * @param string $type selected|checked |
||
162 | * @return string |
||
163 | */ |
||
164 | 7 | protected function get_selected_option($needle, array $haystack, $type = 'selected') |
|
168 | |||
169 | /** |
||
170 | * @param array $row |
||
171 | * @param array $selected_items |
||
172 | * @param string $field |
||
173 | * @param string $column_class |
||
174 | * @param int $column_count |
||
175 | * @param int $index |
||
176 | * @return string |
||
177 | */ |
||
178 | 4 | protected function get_checkbox_column(array $row, array $selected_items, $field, $column_class, $column_count, &$index) |
|
192 | } |
||
193 |