1 | <?php |
||
8 | class Date_Field extends Field { |
||
9 | |||
10 | /** |
||
11 | * Picker options. |
||
12 | * |
||
13 | * @var array |
||
14 | */ |
||
15 | public $picker_options = array( |
||
16 | 'allowInput' => true, |
||
17 | 'dateFormat' => 'Y-m-d', |
||
18 | ); |
||
19 | |||
20 | /** |
||
21 | * The storage format in variant that can be used by JavaScript. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $storage_format = 'Y-m-d'; |
||
26 | |||
27 | /** |
||
28 | * Returns an array that holds the field data, suitable for JSON representation. |
||
29 | * |
||
30 | * @param bool $load Should the value be loaded from the database or use the value from the current instance. |
||
31 | * @return array |
||
32 | */ |
||
33 | public function to_json( $load ) { |
||
34 | $field_data = parent::to_json( $load ); |
||
35 | |||
36 | $field_data = array_merge( $field_data, array( |
||
37 | 'storage_format' => $this->storage_format, |
||
38 | 'picker_options' => $this->picker_options, |
||
39 | ) ); |
||
40 | |||
41 | return $field_data; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Set datepicker options |
||
46 | */ |
||
47 | public function set_picker_options( $options ) { |
||
51 | |||
52 | /** |
||
53 | * Returns the picker options. |
||
54 | */ |
||
55 | public function get_picker_options() { |
||
58 | } |
||
59 |