RWMB_Date_Field

The Evolved RWMB Date Field class.

Defined (1)

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

/meta-box/inc/fields/date.php  
  1. class RWMB_Date_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_enqueue_style( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.css", array( 'jquery-ui-core', 'jquery-ui-theme' ), '1.8.17' ); 
  11.  
  12. $url = RWMB_JS_URL . 'jqueryui'; 
  13. wp_register_script( 'jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.min.js", array( 'jquery-ui-core' ), '1.8.17', true ); 
  14. wp_enqueue_script( 'rwmb-date', RWMB_JS_URL . 'date.js', array( 'jquery-ui-datepicker' ), RWMB_VER, true ); 
  15.  
  16. /** 
  17. * Get field HTML 
  18. * @param string $html 
  19. * @param mixed $meta 
  20. * @param array $field 
  21. * @return string 
  22. */ 
  23. static function html( $html, $meta, $field ) 
  24. $name = " name='{$field['field_name']}'"; 
  25. $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'"; 
  26. $format = " rel='{$field['format']}'"; 
  27. $val = " value='{$meta}'"; 
  28. $html = "<input type='text' class='rwmb-date'{$name}{$id}{$format}{$val} size='30' />"; 
  29.  
  30. return $html;