'yy-mm-dd', 'timeFormat' => 'HH:mm:ss', ); /** * You can use this method to modify the field properties that are added to the JSON object. * The JSON object is used by the Backbone Model and the Underscore template. * * @param bool $load Should the value be loaded from the database or use the value from the current instance. * @return array */ public function to_json( $load ) { $field_data = parent::to_json( $load ); $field_data = array_merge( $field_data, array( 'timepicker_type' => $this->timepicker_type, 'time_format' => $this->get_time_format(), 'interval_step' => $this->get_interval_step(), 'restraints' => $this->get_restraints(), 'timepicker_options' => $this->get_timepicker_options(), ) ); return $field_data; } /** * Prints the main Underscore template. **/ public function template() { ?>
time_format = $time_format; return $this; } /** * Returns the time format. */ public function get_time_format() { return $this->time_format; } /** * Sets the interval step. */ public function set_interval_step( $interval_steps ) { $output = array(); foreach ( $interval_steps as $step_name => $step_value ) { $name = 'step' . ucwords( $step_name ); $output[ $name ] = (int) $step_value; } $this->interval_step = $output; return $this; } /** * Returns the interval step. */ public function get_interval_step() { return $this->interval_step; } /** * Sets the restraints. */ public function set_restraints( $restraints ) { $this->restraints = array_map( 'intval', $restraints ); return $this; } /** * Returns the restraints. */ public function get_restraints() { return $this->restraints; } /** * Sets other timepicker options. */ public function set_timepicker_options( $timepicker_options ) { $this->timepicker_options = $timepicker_options; return $this; } /** * Returns the timepicker options. */ public function get_timepicker_options() { return $this->timepicker_options; } }