RWMB_Color_Field

The Evolved RWMB Color Field class.

Defined (1)

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

/meta-box/inc/fields/color.php  
  1. class RWMB_Color_Field 
  2. /** 
  3. * Enqueue scripts and styles 
  4. * @return void 
  5. */ 
  6. static function admin_enqueue_scripts() 
  7. wp_enqueue_style( 'rwmb-color', RWMB_CSS_URL.'color.css', array( 'farbtastic' ), RWMB_VER ); 
  8. wp_enqueue_script( 'rwmb-color', RWMB_JS_URL.'color.js', array( 'farbtastic' ), RWMB_VER, true ); 
  9.  
  10. /** 
  11. * Get field HTML 
  12. * @param string $html 
  13. * @param mixed $meta 
  14. * @param array $field 
  15. * @return string 
  16. */ 
  17. static function html( $html, $meta, $field ) 
  18. if ( empty( $meta ) ) 
  19. $meta = '#'; 
  20. $name = " name='{$field['field_name']}'"; 
  21. $id = isset( $field['clone'] ) && $field['clone'] ? '' : " id='{$field['id']}'"; 
  22. $value = " value='{$meta}'"; 
  23.  
  24. $html = <<<HTML 
  25. <input class="rwmb-color" type="text"{$name}{$id}{$value} size="8" /> 
  26. <div class="rwmb-color-picker"></div> 
  27. HTML; 
  28.  
  29. return $html;