1 | <?php |
||
9 | abstract class Predefined_Options_Field extends Field { |
||
10 | /** |
||
11 | * Stores the field options (if any) |
||
12 | * |
||
13 | * @var array |
||
14 | **/ |
||
15 | protected $options = array(); |
||
16 | |||
17 | /** |
||
18 | * Set the field options |
||
19 | * Callbacks are supported |
||
20 | * |
||
21 | * @param array|callback $options |
||
22 | */ |
||
23 | protected function _set_options( $options ) { |
||
26 | |||
27 | /** |
||
28 | * Add options to the field |
||
29 | * Callbacks are supported |
||
30 | * |
||
31 | * @param array|callback $options |
||
32 | */ |
||
33 | protected function _add_options( $options ) { |
||
36 | |||
37 | /** |
||
38 | * Set the options of this field. |
||
39 | * Accepts either array of data or a callback that returns the data. |
||
40 | * |
||
41 | * @param array|callable $options |
||
42 | */ |
||
43 | public function set_options( $options ) { |
||
47 | |||
48 | /** |
||
49 | * Add new options to this field. |
||
50 | * Accepts either array of data or a callback that returns the data. |
||
51 | * |
||
52 | * @param array|callbacle $options |
||
53 | */ |
||
54 | public function add_options( $options ) { |
||
58 | |||
59 | /** |
||
60 | * Check if there are callbacks and populate the options |
||
61 | */ |
||
62 | protected function load_options() { |
||
80 | |||
81 | /** |
||
82 | * Changes the options array structure. This is needed to keep the array items order when it is JSON encoded. |
||
83 | * |
||
84 | * @param array $options |
||
85 | * @return array |
||
86 | */ |
||
87 | public function parse_options( $options ) { |
||
99 | |||
100 | } // END Field |
||
101 |