RWMB_Time_Field

The Evolved RWMB Time Field class.

Defined (1)

The class is defined in the following location(s).

/meta-box/inc/fields/time.php  
  1. class RWMB_Time_Field 
  2. /** 
  3. * Enqueue scripts and styles 
  4. * @return void 
  5. */ 
  6. static function admin_enqueue_scripts( ) 
  7. $url = RWMB_CSS_URL . 'jqueryui'; 
  8. wp_register_style( 'jquery-ui-core', "{$url}/jquery.ui.core.css", array( ), '1.8.17' ); 
  9. wp_register_style( 'jquery-ui-theme', "{$url}/jquery.ui.theme.css", array( ), '1.8.17' ); 
  10. wp_register_style( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.css", array( 'jquery-ui-core', 'jquery-ui-theme' ), '1.8.17' ); 
  11. wp_register_style( 'jquery-ui-slider', "{$url}/jquery.ui.slider.css", array( 'jquery-ui-core', 'jquery-ui-theme' ), '1.8.17' ); 
  12. wp_enqueue_style( 'jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.css", array( 'jquery-ui-datepicker', 'jquery-ui-slider' ), '0.9.7' ); 
  13.  
  14. $url = RWMB_JS_URL . 'jqueryui'; 
  15. wp_register_script( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.min.js", array( 'jquery-ui-core' ), '1.8.17', true ); 
  16. wp_register_script( 'jquery-ui-slider', "{$url}/jquery.ui.slider.min.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse' ), '1.8.17', true ); 
  17. wp_register_script( 'jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.js", array( 'jquery-ui-datepicker', 'jquery-ui-slider' ), '0.9.7', true ); 
  18. wp_enqueue_script( 'rwmb-time', RWMB_JS_URL.'time.js', array( 'jquery-ui-timepicker' ), RWMB_VER, true ); 
  19.  
  20. /** 
  21. * Get field HTML 
  22. * @param string $html 
  23. * @param mixed $meta 
  24. * @param array $field 
  25. * @return string 
  26. */ 
  27. static function html( $html, $meta, $field ) 
  28. $name = " name='{$field['field_name']}'"; 
  29. $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'"; 
  30. $rel = " rel='{$field['format']}'"; 
  31. $val = " value='{$meta}'"; 
  32. $html .= "<input type='text' class='rwmb-time' size='30'{$name}{$id}{$rel}{$val} />"; 
  33.  
  34. return $html;