/** * The run() method. * * This will initialize the plugin on the 'after_setup_theme' action. * * @internal * @since 0.5.0 * @param array $args array of class arguments (passed by the plugin utility class) */ protected function run() { FieldManager::init(); General::instance(); if (is_admin()) { Admin::instance(); } // use after_setup_theme action so it is initialized as soon as possible, but also so that both plugins and themes can use the action add_action('after_setup_theme', array($this, 'init'), 1); add_filter('wpdlib_menu_validated', array($this, 'menu_validated'), 10, 2); add_filter('wpod_screen_validated', array($this, 'screen_validated'), 10, 2); add_filter('wpod_tab_validated', array($this, 'tab_validated'), 10, 2); add_filter('wpod_section_validated', array($this, 'section_validated'), 10, 2); }
/** * Renders the tab navigation. * * @since 0.5.0 * @param array $tabs array of WPOD\Components\Tab objects * @param WPOD\Components\Tab $current_tab the current tab object */ protected function render_tab_navigation($tabs, $current_tab) { $current_url = Admin::instance()->get_current_url(); echo '<h2 class="nav-tab-wrapper">'; foreach ($tabs as $tab) { $class = 'nav-tab'; if ($tab->slug == $current_tab->slug) { $class .= ' nav-tab-active'; } echo '<a class="' . $class . '" href="' . add_query_arg('tab', $tab->slug, $current_url) . '">' . $tab->title . '</a>'; } echo '</h2>'; }