Esempio n. 1
0
 /**
  * Add a container to the tab.
  *
  * @param THB_Container $container The container about to be inserted.
  * @param int $index The insertion index.
  * @return void
  */
 public function addContainer($container, $index = false)
 {
     $container->setTabSlug($this->_slug);
     if ($index === false) {
         $this->_containers[] = $container;
     } else {
         $this->_containers = thb_array_insert($this->_containers, $container, $index);
     }
 }
 /**
  * Add a custom metabox to the post type.
  *
  * @param THB_Metabox $metabox The custom metabox.
  * @param array $templates The admin templates that should display
  * the metabox.
  * @param int $index The insertion index.
  * @return void
  */
 public function addMetabox($metabox, $templates = array(), $index = false)
 {
     $add = true;
     if (!empty($templates)) {
         $add = thb_is_admin_template($templates);
     }
     // if( empty($_POST) && is_admin() ) {
     // 	foreach( $conditions as $condition ) {
     // 		if( !$condition ) {
     // 			$add = false;
     // 			break;
     // 		}
     // 	}
     // }
     if ($add) {
         $metabox->setPostType($this->_type);
         $metabox = apply_filters('thb_' . $metabox->getSlug() . '_metabox', $metabox);
         if ($index === false) {
             $this->_metaboxes[] = $metabox;
         } else {
             $this->_metaboxes = thb_array_insert($this->_metaboxes, $metabox, $index);
         }
     }
 }