1 | <?php |
||
14 | abstract class cfg_fields |
||
15 | { |
||
16 | /** @var user */ |
||
17 | protected $user; |
||
18 | |||
19 | /** |
||
20 | * Constructor |
||
21 | * |
||
22 | * @param user $user User object |
||
23 | */ |
||
24 | 44 | public function __construct(user $user) |
|
28 | |||
29 | /** |
||
30 | * Used to add multi-select drop down in blocks config |
||
31 | * |
||
32 | * @param array $option_ary |
||
33 | * @param $selected_items |
||
34 | * @param $key |
||
35 | * @return string |
||
36 | */ |
||
37 | 3 | public function build_multi_select(array $option_ary, $selected_items, $key) |
|
51 | |||
52 | /** |
||
53 | * Used to build multi-column checkboxes for blocks config |
||
54 | * |
||
55 | * if multi-dimensional array, we break the checkboxes into columns ex. |
||
56 | * array( |
||
57 | * 'news' => array( |
||
58 | * 'field1' => 'Label 1', |
||
59 | * 'field2' => 'Label 2', |
||
60 | * ), |
||
61 | * 'articles' => array( |
||
62 | * 'field1' => 'Label 1', |
||
63 | * 'field2' => 'Label 2', |
||
64 | * ), |
||
65 | * ) |
||
66 | * @param array $option_ary |
||
67 | * @param $selected_items |
||
68 | * @param $field |
||
69 | * @return string |
||
70 | */ |
||
71 | 4 | public function build_checkbox(array $option_ary, $selected_items, $field) |
|
86 | |||
87 | /** |
||
88 | * build hidden field for blocks config |
||
89 | * |
||
90 | * @param $value |
||
91 | * @param $key |
||
92 | * @return string |
||
93 | */ |
||
94 | 2 | public function build_hidden($value, $key) |
|
98 | |||
99 | /** |
||
100 | * @param $selected_items |
||
101 | * @return array |
||
102 | */ |
||
103 | 12 | protected function _ensure_array($selected_items) |
|
107 | |||
108 | /** |
||
109 | * @param $options |
||
110 | * @param $css_class |
||
111 | * @return array |
||
112 | */ |
||
113 | 4 | protected function _ensure_multi_array($options, &$css_class) |
|
123 | |||
124 | /** |
||
125 | * @param string $needle |
||
126 | * @param array $haystack |
||
127 | * @param string $type selected|checked |
||
128 | * @return string |
||
129 | */ |
||
130 | 10 | protected function _get_selected_option($needle, array $haystack, $type = 'selected') |
|
134 | |||
135 | /** |
||
136 | * @param array $row |
||
137 | * @param array $selected_items |
||
138 | * @param string $field |
||
139 | * @param integer $column_count |
||
140 | * @param string $column_class |
||
141 | * @return string |
||
142 | */ |
||
143 | 4 | protected function _get_checkbox_column(array $row, array $selected_items, $field, $column_count, $column_class) |
|
156 | } |
||
157 |