$tab Tab definition (optional `icon` key). * @return string Dashicons class. */ public static function tab_icon( $slug, array $tab = array() ) { if ( ! empty( $tab['icon'] ) && is_string( $tab['icon'] ) ) { return sanitize_html_class( $tab['icon'] ); } $icons = array( 'work' => 'dashicons-media-default', 'tools' => 'dashicons-admin-tools', 'journal' => 'dashicons-list-view', 'accounts' => 'dashicons-groups', 'style' => 'dashicons-admin-appearance', 'settings' => 'dashicons-admin-generic', 'help' => 'dashicons-welcome-learn-more', 'support' => 'dashicons-sos', ); return isset( $icons[ $slug ] ) ? $icons[ $slug ] : 'dashicons-admin-page'; } /** * Prints the opening of an admin page: the wrapper, the header and, * when there is more than one tab, the tab bar. * * The caller closes the wrapper with its usual ``. The * `wp-header-end` marker is printed AFTER the tab bar so WordPress puts * its notices under the tabs, never between the header and the tabs. * * @param string $title Page title (already translated). * @param string $description What the page is for (already translated, may be empty). * @param string $icon Dashicons class of the page. * @param array> $tabs Tabs: slug => array( 'label' => string, 'url' => string, 'icon' => string (optional) ). * @param string $active Slug of the active tab. * @return void */ public static function render_page_top( $title, $description, $icon, array $tabs = array(), $active = '' ) { $has_tabs = count( $tabs ) > 1; ?>

v

> $tabs Tabs: slug => array( 'label', 'url', 'icon' (optional) ). * @param string $active Slug of the active tab. * @return void */ private static function render_tabs( array $tabs, $active ) { ?> > $panels Part key => array( 'label' => string, 'callback' => callable ). * @return void */ public static function render_subpanels( $screen, array $panels ) { $screen = sanitize_key( $screen ); /** * Adds parts to a screen. Each part: 'label' (string) and 'callback' (callable printing the content, * without the page header and without closing the page). * * @param array> $panels Part key => label, callback. */ $panels = apply_filters( 'vefdk_subpanels_' . $screen, $panels ); if ( 1 === count( $panels ) ) { $panel = reset( $panels ); call_user_func( $panel['callback'] ); return; } echo ''; $first = true; foreach ( $panels as $key => $panel ) { printf( '
', esc_attr( $screen ), esc_attr( sanitize_key( $key ) ), $first ? '' : ' hidden' ); call_user_func( $panel['callback'] ); echo '
'; $first = false; } } }