* AdminShell::nav( ... ); *
...card... AdminShell::bottom_banners( ... );
*
... AdminShell::promo_cards( ... );
*
*/ final class AdminShell { /** * Render the left column: logo, quick search, then the link groups. * * @param string $subtitle Screen name under the logo, e.g. "Settings". * @param array> $groups Each with 'id', 'label', optional 'icon' (a dashicons class * suffix) and 'open', and 'items': each with 'label', 'url', * and optional 'current' and 'anchor' (an element id on this * page the link scrolls to, for scroll-tracking). * @param array> $index Search entries, each with 'label', 'context', 'url' and * optional 'keywords'. * @return void */ public static function nav( string $subtitle, array $groups, array $index ): void { ?> $args { * Page settings. * * @type string $title Header card title (plain text). * @type string $description Line under the title. * @type string $class Extra classes for the wrap. * } * @return void */ public static function page_start( array $args ): void { $args = wp_parse_args( $args, array( 'title' => '', 'description' => '', 'class' => '', ) ); ?>

'dashicons-dashboard', Menu::SLUG . '-settings' => 'dashicons-admin-settings', 'aiou-woo' => 'dashicons-cart', Menu::SLUG . '-tools' => 'dashicons-admin-tools', Menu::SLUG . '-system-report' => 'dashicons-clipboard', Menu::SLUG . '-about' => 'dashicons-info-outline', 'aiou-database-cleanup' => 'dashicons-database', 'aiou-email-log' => 'dashicons-email-alt', 'aiou-chat' => 'dashicons-format-chat', ); $current = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only menu highlight. ?> 'dashicons-admin-users', 'login' => 'dashicons-lock', 'security' => 'dashicons-shield', 'media' => 'dashicons-format-image', 'admin' => 'dashicons-admin-appearance', 'performance' => 'dashicons-performance', 'content' => 'dashicons-admin-page', 'duplicates' => 'dashicons-admin-page', 'custom_code' => 'dashicons-editor-code', 'content_types' => 'dashicons-admin-post', 'emails' => 'dashicons-email-alt', 'woocommerce' => 'dashicons-cart', // The Woo Add-on's tabs, each its own icon so they stay apart // on the collapsed rail. 'woo_cart_rules' => 'dashicons-cart', 'woo_display' => 'dashicons-store', 'woo_product_page' => 'dashicons-products', 'woo_checkout_fields' => 'dashicons-feedback', 'woo_registration' => 'dashicons-id-alt', 'woo_product_reviews' => 'dashicons-star-filled', 'woo_states' => 'dashicons-location', 'woo_orders' => 'dashicons-clipboard', 'woo_payments' => 'dashicons-money-alt', 'woo_shipping' => 'dashicons-car', 'woo_emails' => 'dashicons-email-alt', 'woo_related_products' => 'dashicons-networking', 'woo_cart_fragments' => 'dashicons-performance', 'woo_recaptcha' => 'dashicons-shield', 'woo_rewards' => 'dashicons-awards', 'woo_cart_recovery' => 'dashicons-backup', 'woo_stock_alerts' => 'dashicons-bell', 'woo_customers' => 'dashicons-groups', ); $icon = $icons[ $tab_id ] ?? ( 0 === strpos( $tab_id, 'woo' ) ? 'dashicons-cart' : 'dashicons-admin-generic' ); /** * Filters the dashicon shown beside a settings tab in the Settings * screen's left column. * * @param string $icon Dashicons class, e.g. 'dashicons-admin-users'. * @param string $tab_id Tab id. */ return (string) apply_filters( 'aiou_settings_tab_icon', $icon, $tab_id ); } /** * Dashicon for a settings section's title tile. Covers Free's sections * and the ones Pro and the Woo Add-on add; anything else falls back to * its tab's icon. * * @param string $tab_id Tab id. * @param string $section_id Section id. * @return string Dashicons class. */ public static function section_icon( string $tab_id, string $section_id ): string { $icons = array( // Users. 'username_updater' => 'dashicons-id', 'user_roles' => 'dashicons-groups', 'user_avatar' => 'dashicons-format-image', 'user_switching' => 'dashicons-randomize', 'users_screen' => 'dashicons-list-view', 'sessions' => 'dashicons-clock', 'temporary_access' => 'dashicons-backup', // Login. 'login_preview' => 'dashicons-visibility', 'login_logo' => 'dashicons-wordpress-alt', 'login_background' => 'dashicons-format-gallery', 'login_elements' => 'dashicons-forms', 'login_design' => 'dashicons-art', 'login_texts' => 'dashicons-editor-textcolor', 'register_texts' => 'dashicons-welcome-add-page', 'lostpassword_texts' => 'dashicons-sos', 'resetpass_texts' => 'dashicons-update', 'shared_texts' => 'dashicons-text', 'custom_login_url' => 'dashicons-admin-links', 'login_redirects' => 'dashicons-migrate', // Security. 'security_access' => 'dashicons-shield', 'login_attempts' => 'dashicons-dismiss', 'author_pages' => 'dashicons-businessperson', 'ip_address' => 'dashicons-location', 'ip_rules' => 'dashicons-location-alt', 'two_factor' => 'dashicons-smartphone', 'password_policy' => 'dashicons-privacy', 'login_notifications' => 'dashicons-bell', 'login_log' => 'dashicons-list-view', 'recaptcha' => 'dashicons-yes-alt', // Media. 'default_featured_image' => 'dashicons-format-image', 'require_featured_image' => 'dashicons-warning', 'svg_uploads' => 'dashicons-media-code', 'filename_cleanup' => 'dashicons-editor-removeformatting', 'media_tools' => 'dashicons-admin-media', // Admin. 'show_ids' => 'dashicons-tag', 'dashboard' => 'dashicons-dashboard', 'dashboard_layout' => 'dashicons-layout', 'custom_widgets' => 'dashicons-welcome-widgets-menus', 'admin_footer' => 'dashicons-editor-insertmore', 'wp_version' => 'dashicons-wordpress', 'admin_bar' => 'dashicons-menu-alt3', 'admin_menu' => 'dashicons-menu', 'admin_notices' => 'dashicons-megaphone', 'color_scheme' => 'dashicons-admin-appearance', 'white_label' => 'dashicons-flag', 'chat_launcher' => 'dashicons-format-chat', // Performance. 'frontend_performance' => 'dashicons-performance', 'head_cleanup' => 'dashicons-editor-code', 'admin_experience' => 'dashicons-admin-generic', 'comments' => 'dashicons-admin-comments', 'maintenance' => 'dashicons-hammer', 'feeds' => 'dashicons-rss', 'editor' => 'dashicons-edit-page', 'updates' => 'dashicons-update', 'accessibility' => 'dashicons-universal-access', 'script_loading' => 'dashicons-media-code', 'cleanup_schedule' => 'dashicons-calendar-alt', 'revisions' => 'dashicons-backup', 'cart_fragments' => 'dashicons-cart', // Content. 'duplicate_post' => 'dashicons-admin-page', 'post_expiration' => 'dashicons-calendar', 'custom_sorting' => 'dashicons-sort', 'redirects' => 'dashicons-randomize', 'matching' => 'dashicons-search', 'exclusions' => 'dashicons-hidden', 'automation' => 'dashicons-controls-repeat', 'notifications' => 'dashicons-bell', // Custom code. 'code' => 'dashicons-editor-code', 'snippets' => 'dashicons-editor-code', // Post types (Pro). 'post_types' => 'dashicons-admin-post', 'taxonomies' => 'dashicons-tag', // Emails. 'sender' => 'dashicons-businessman', 'test_email' => 'dashicons-email', 'admin_emails' => 'dashicons-admin-users', 'user_emails' => 'dashicons-groups', 'logging' => 'dashicons-list-view', 'smtp' => 'dashicons-email-alt2', 'email_queue' => 'dashicons-database', 'email_retry' => 'dashicons-controls-repeat', 'notification_rules' => 'dashicons-filter', 'admin_alerts' => 'dashicons-warning', // WooCommerce. 'country_states' => 'dashicons-admin-site-alt3', 'rewards' => 'dashicons-awards', 'purchase' => 'dashicons-money-alt', 'related_products' => 'dashicons-products', 'product_reviews' => 'dashicons-star-filled', // Licenses. 'license' => 'dashicons-admin-network', ); $icon = $icons[ $section_id ] ?? self::tab_icon( $tab_id ); /** * Filters the dashicon shown in a settings section's title tile. * * @param string $icon Dashicons class, e.g. 'dashicons-shield'. * @param string $tab_id Tab id. * @param string $section_id Section id. */ return (string) apply_filters( 'aiou_settings_section_icon', $icon, $tab_id, $section_id ); } /** * Render the right column's promotion cards, contributed by any plugin * via the `aiou_settings_promo_cards` filter. A provider should check * `$page` itself (the second filter argument) and only add cards * relevant to the screen being rendered. * * @param string $page The settings `registry_page`, or 'tools' on the Tools screen. * @return void */ public static function promo_cards( string $page ): void { /** * Filters the list of promotion cards shown in the Settings and * Tools screens' right-hand column. * * @param array> $cards Cards so far, each with * 'icon' (a dashicons class * suffix), 'title', 'body', * 'cta_label', and 'cta_url' -- * or 'render' (a callable that * prints the card's inside) and * an optional 'class'. * @param string $page The `registry_page` being rendered, or 'tools'. */ $cards = apply_filters( 'aiou_settings_promo_cards', array(), $page ); if ( ! $cards ) { return; } echo '