예제 #1
0
 /**
  * Adds screens and their subcomponents.
  *
  * @internal
  * @since 0.5.0
  * @param array $screens the screens to add as $screen_slug => $screen_args
  * @param WPDLib\Components\Menu $menu the menu to add the screens to
  */
 protected function add_screens($screens, $menu)
 {
     foreach ($screens as $screen_slug => $screen_args) {
         $screen = $menu->add(new Screen($screen_slug, $screen_args));
         if (is_wp_error($screen)) {
             self::doing_it_wrong(__METHOD__, $screen->get_error_message(), '0.5.0');
         } elseif (isset($screen_args['tabs']) && is_array($screen_args['tabs'])) {
             $this->add_tabs($screen_args['tabs'], $screen);
         }
     }
 }
예제 #2
0
 /**
  * Adds post types and their subcomponents.
  *
  * @internal
  * @since 0.5.0
  * @param array $post_types the post types to add as $post_type_slug => $post_type_args
  * @param WPDLib\Components\Menu $menu the menu to add the post types to
  */
 protected function add_post_types($post_types, $menu)
 {
     foreach ($post_types as $post_type_slug => $post_type_args) {
         $post_type = $menu->add(new PostType($post_type_slug, $post_type_args));
         if (is_wp_error($post_type)) {
             self::doing_it_wrong(__METHOD__, $post_type->get_error_message(), '0.5.0');
         } else {
             if (isset($post_type_args['taxonomies']) && is_array($post_type_args['taxonomies'])) {
                 $this->add_taxonomies($post_type_args['taxonomies'], $post_type);
             }
             if (isset($post_type_args['metaboxes']) && is_array($post_type_args['metaboxes'])) {
                 $this->add_metaboxes($post_type_args['metaboxes'], $post_type);
             }
         }
     }
 }