RW_Meta_Box::__construct PHP Method

__construct() public method

Create meta box based on given data
public __construct ( array $meta_box )
$meta_box array Meta box definition
    public function __construct($meta_box)
    {
        $meta_box = self::normalize($meta_box);
        $meta_box['fields'] = self::normalize_fields($meta_box['fields']);
        $this->meta_box = $meta_box;
        $this->fields =& $this->meta_box['fields'];
        if ($this->is_shown()) {
            $this->global_hooks();
            $this->object_hooks();
        }
    }

Usage Example

 /**
  * Constructor
  * Call parent constructor and add specific hooks
  *
  * @param array $meta_box
  */
 public function __construct($meta_box)
 {
     // Allow to set 'settings_pages' param by string
     if (isset($meta_box['settings_pages']) && is_string($meta_box['settings_pages'])) {
         $meta_box['settings_pages'] = array($meta_box['settings_pages']);
     }
     parent::__construct($meta_box);
     // Prevent adding meta box to post
     $this->meta_box['post_types'] = $this->meta_box['pages'] = array();
     remove_action('add_meta_boxes', array($this, 'add_meta_boxes'));
     remove_action('save_post_post', array($this, 'save_post'));
     add_action('mb_settings_page_load', array($this, 'load'));
 }
All Usage Examples Of RW_Meta_Box::__construct