Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions inc/admin-pages/class-base-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
*/
abstract class Base_Admin_Page {

/**
* SVG data URI for the Ultimate Multisite menu icon.
*
* Used instead of a custom dashicon class so the icon renders on all admin
* pages, not just pages where the full admin.css stylesheet is enqueued.
*
* @since 2.5.2
* @var string
*/
const MENU_ICON_SVG = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGZpbGw9ImJsYWNrIiB0cmFuc2Zvcm09InNjYWxlKDEsLTEpIHRyYW5zbGF0ZSgwLC0xMDI0KSIgZD0iTTQ0OS41OTYgNTIwLjU0bDI5OC4xNjQgNDUyLjI1OS0yMDUuMDAzLTQ4Ni4wODR6TTU3Ni4wNTggNDAxLjA2MGwtMjk4LjE2NC00NTIuMjU5IDIwNS4wMDMgNDg2LjA3OHpNNDQ5LjU5NiA1MTguMDYybDMzLjI2NC04MS40MDUgOTMuNTYyLTM0LjA2NC0zMy43ODIgODEuOTE2ek02NzUuNTk2IDcwNy4zMTljODEuODM5LTUzLjQ1OSAxMzUuOTE4LTE0NS44NzYgMTM1LjkxOC0yNTAuOTI0IDAtMTY1LjQxOS0xMzQuMDk1LTI5OS41MDUtMjk5LjUxNS0yOTkuNTA1LTE3LjAxNSAwLTMzLjY4IDEuNDE4LTQ5LjkxOSA0LjE0Mmw0Ni4zNDEgNzMuNzk5YzIuMzE2LTAuMDc1IDQuNjQ0LTAuMTE1IDYuOTc2LTAuMTE1IDEyMC42OTkgMCAyMTguNTQyIDk3Ljg0NCAyMTguNTQyIDIxOC41NDIgMCA3Mi41OTgtMzUuNCAxMzYuOTM3LTg5Ljg3OCAxNzYuNjc5ek01MTIgNzU1LjkwMWMxNy43MjUgMCAzNS4wOTYtMS41MzkgNTEuOTgtNC40OTVsLTUxLjEzNi03OS42MjEtMS4xNzUtMC4wMThjLTExOC45NzgtMS45ODUtMjE0LjgyLTk5LjA1OS0yMTQuODItMjE4LjUwNCAwLTY5LjMxOCAzMi4yNjUtMTMxLjA5NiA4Mi42MTctMTcxLjEzN2wtMzEuMzAzLTc2LjQ5NWMtODEuNzA0IDUzLjQ4NS0xMzUuNjc3IDE0NS44MzUtMTM1LjY3NyAyNTAuNzYzIDAgMTY1LjQxOSAxMzQuMDk1IDI5OS41MDUgMjk5LjUxNSAyOTkuNTA1eiIvPjwvc3ZnPg==';

/**
* In Edit mode
*
Expand Down
7 changes: 6 additions & 1 deletion inc/admin-pages/class-dashboard-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
/**
* Dashicon to be used on the menu item. This is only used on top-level menus
*
* Set to the SVG data URI constant in init() so the icon renders on all
* admin pages without requiring the full admin.css stylesheet.
*
* @since 1.8.2
* @var string
*/
protected $menu_icon = 'dashicons-wu-wp-ultimo';
protected $menu_icon = '';

/**
* If this number is greater than 0, a badge with the number will be displayed alongside the menu title
Expand Down Expand Up @@ -96,6 +99,8 @@ class Dashboard_Admin_Page extends Base_Admin_Page {
*/
public function init(): void {

$this->menu_icon = self::MENU_ICON_SVG;

parent::init();

/*
Expand Down
2 changes: 1 addition & 1 deletion inc/admin-pages/class-multisite-setup-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct() {

$this->type = 'menu';
$this->position = 10_101_010;
$this->menu_icon = 'dashicons-wu-wp-ultimo';
$this->menu_icon = self::MENU_ICON_SVG;

parent::__construct();

Expand Down
2 changes: 1 addition & 1 deletion inc/admin-pages/class-settings-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Settings_Admin_Page extends Wizard_Admin_Page {
* @since 1.8.2
* @var string
*/
protected $menu_icon = 'dashicons-wu-wp-ultimo';
protected $menu_icon = '';

/**
* If this number is greater than 0, a badge with the number will be displayed alongside the menu title
Expand Down
2 changes: 1 addition & 1 deletion inc/admin-pages/class-setup-wizard-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function __construct() {

$this->position = 10_101_010;

$this->menu_icon = 'dashicons-wu-wp-ultimo';
$this->menu_icon = self::MENU_ICON_SVG;

add_action('admin_enqueue_scripts', [$this, 'register_scripts']);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Admin_Pages/Dashboard_Admin_Page_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ public function test_page_id(): void {
}

/**
* Test menu_icon is set.
* Test menu_icon is set to the SVG data URI constant.
*/
public function test_menu_icon(): void {

$reflection = new \ReflectionClass($this->page);
$property = $reflection->getProperty('menu_icon');
$property->setAccessible(true);

$this->assertEquals('dashicons-wu-wp-ultimo', $property->getValue($this->page));
$this->assertEquals(Base_Admin_Page::MENU_ICON_SVG, $property->getValue($this->page));
}

/**
Expand Down
Loading