/** * Register the plugin's custom admin menu. * * Page and subpages are defined in the related config file and * can be extended by filters. * * @since 1.0 */ public function admin_menu() { $admin_menu = WPMOLY_Settings::get_admin_menu(); add_dashboard_page($page_title = __('About WPMovieLibrary', 'wpmovielibrary'), $menu_title = __('About WPMovieLibrary', 'wpmovielibrary'), $capability = 'manage_options', $menu_slug = 'wpmovielibrary-about', $function = 'WPMovieLibrary_Admin::about_page'); remove_submenu_page('index.php', 'wpmovielibrary-about'); extract($admin_menu['page']); add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position); foreach ($admin_menu['subpages'] as $id => $subpage) { extract($subpage, EXTR_PREFIX_ALL | EXTR_OVERWRITE, 'subpage'); if (is_null($subpage_condition) || !is_null($subpage_condition) && false != call_user_func($subpage_condition)) { $screen_hook = add_submenu_page($menu_slug, $subpage_page_title, __($subpage_menu_title, 'wpmovielibrary'), $subpage_capability, $subpage_menu_slug, $subpage_function); $this->screen_hooks[$id] = $screen_hook; if (true === $subpage_hide) { $this->hidden_pages[] = array('menu_slug' => $menu_slug, 'subpage_menu_slug' => $subpage_menu_slug); } if (!empty($subpage_actions)) { foreach ($subpage_actions as $hook => $callback) { if (is_callable($callback)) { $hook = str_replace('{screen_hook}', $screen_hook, $hook); add_action($hook, $callback); } } } } } }