/** * Get started */ function __construct($meta_box, $object_id = 0) { if (empty($meta_box['id'])) { wp_die(__('Metabox configuration is required to have an ID parameter', 'cmb2')); } $this->meta_box = wp_parse_args($meta_box, $this->mb_defaults); $this->object_id($object_id); $this->mb_object_type(); $this->cmb_id = $meta_box['id']; CMB2_Boxes::add($this); }
/** * Get started */ function __construct($meta_box, $object_id = 0) { if (empty($meta_box['id'])) { wp_die(__('Metabox configuration is required to have an ID parameter', 'cmb2')); } $this->meta_box = wp_parse_args($meta_box, $this->mb_defaults); $this->object_id($object_id); $this->mb_object_type(); $this->cmb_id = $meta_box['id']; CMB2_Boxes::add($this); /** * Hook during initiation of CMB2 object * * The dynamic portion of the hook name, $this->cmb_id, is this meta_box id. * * @param array $cmb This CMB2 object */ do_action("cmb2_init_{$this->cmb_id}", $this); }
/** * Get started * @since 0.4.0 * @param array $meta_box Metabox config array * @param integer $object_id Optional object id */ public function __construct($meta_box, $object_id = 0) { if (empty($meta_box['id'])) { wp_die(__('Metabox configuration is required to have an ID parameter', 'cmb2')); } $this->meta_box = wp_parse_args($meta_box, $this->mb_defaults); $this->object_id($object_id); $this->mb_object_type(); $this->cmb_id = $meta_box['id']; // Add custom classes to metabox $post_type_object = $this->meta_box['object_types']; foreach ($post_type_object as $page) { add_filter("postbox_classes_{$page}_{$this->meta_box['id']}", array($this, 'add_class_to_metabox')); } CMB2_Boxes::add($this); /** * Hook during initiation of CMB2 object * * The dynamic portion of the hook name, $this->cmb_id, is this meta_box id. * * @param array $cmb This CMB2 object */ do_action("cmb2_init_{$this->cmb_id}", $this); }