1 | <?php |
||
8 | class Date_Field extends Field { |
||
9 | |||
10 | /** |
||
11 | * Datepicker options |
||
12 | */ |
||
13 | public $datepicker_options = array(); |
||
14 | |||
15 | /** |
||
16 | * Returns an array that holds the field data, suitable for JSON representation. |
||
17 | * This data will be available in the Underscore template and the Backbone Model. |
||
18 | * |
||
19 | * @param bool $load Should the value be loaded from the database or use the value from the current instance. |
||
20 | * @return array |
||
21 | */ |
||
22 | public function to_json( $load ) { |
||
23 | $field_data = parent::to_json( $load ); |
||
24 | |||
25 | $field_data = array_merge( $field_data, array( |
||
26 | 'options' => $this->datepicker_options, |
||
27 | ) ); |
||
28 | |||
29 | return $field_data; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * The Underscore template of this field |
||
34 | **/ |
||
35 | public function template() { |
||
43 | |||
44 | /** |
||
45 | * Hook administration scripts and styles. |
||
46 | */ |
||
47 | public function admin_enqueue_scripts() { |
||
53 | |||
54 | /** |
||
55 | * This function is depratected since it conflicts with the options concept in predefined option fields. |
||
56 | * @deprecated |
||
57 | */ |
||
58 | public function set_options( $options ) { |
||
61 | |||
62 | /** |
||
63 | * Set datepicker options |
||
64 | */ |
||
65 | public function set_datepicker_options( $options ) { |
||
70 | } |
||
71 |