1 | <?php |
||
8 | class Time_Field extends Field { |
||
9 | /** |
||
10 | * Timepicker type. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $timepicker_type = 'timepicker'; |
||
15 | |||
16 | /** |
||
17 | * Time format. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | public $time_format = 'hh:mm tt'; |
||
22 | |||
23 | /** |
||
24 | * Interval step for hours, minutes and seconds. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | public $interval_step = array(); |
||
29 | |||
30 | /** |
||
31 | * Restraints for hours, minutes, seconds and dates. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | public $restraints = array(); |
||
36 | |||
37 | /** |
||
38 | * Timepicker options. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | public $timepicker_options = array( |
||
43 | 'dateFormat' => 'yy-mm-dd', |
||
44 | 'timeFormat' => 'HH:mm:ss', |
||
45 | ); |
||
46 | |||
47 | /** |
||
48 | * You can use this method to modify the field properties that are added to the JSON object. |
||
49 | * The JSON object is used by the Backbone Model and the Underscore template. |
||
50 | * |
||
51 | * @param bool $load Should the value be loaded from the database or use the value from the current instance. |
||
52 | * @return array |
||
53 | */ |
||
54 | public function to_json( $load ) { |
||
67 | |||
68 | /** |
||
69 | * Prints the main Underscore template. |
||
70 | **/ |
||
71 | public function template() { |
||
79 | |||
80 | /** |
||
81 | * This method is called in the admin_enqueue_scripts action. It is called once per field type. |
||
82 | * Enqueues field scripts and styles. |
||
83 | */ |
||
84 | public function admin_enqueue_scripts() { |
||
92 | |||
93 | /** |
||
94 | * Sets the time format. |
||
95 | */ |
||
96 | public function set_time_format( $time_format ) { |
||
101 | |||
102 | /** |
||
103 | * Returns the time format. |
||
104 | */ |
||
105 | public function get_time_format() { |
||
108 | |||
109 | /** |
||
110 | * Sets the interval step. |
||
111 | */ |
||
112 | public function set_interval_step( $interval_steps ) { |
||
124 | |||
125 | /** |
||
126 | * Returns the interval step. |
||
127 | */ |
||
128 | public function get_interval_step() { |
||
131 | |||
132 | /** |
||
133 | * Sets the restraints. |
||
134 | */ |
||
135 | public function set_restraints( $restraints ) { |
||
140 | |||
141 | /** |
||
142 | * Returns the restraints. |
||
143 | */ |
||
144 | public function get_restraints() { |
||
147 | |||
148 | /** |
||
149 | * Sets other timepicker options. |
||
150 | */ |
||
151 | public function set_timepicker_options( $timepicker_options ) { |
||
156 | |||
157 | /** |
||
158 | * Returns the timepicker options. |
||
159 | */ |
||
160 | public function get_timepicker_options() { |
||
163 | } |
||
164 |