Skip to content

Commit

Permalink
Move plugin related sub menu items to new Plugins menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Nov 29, 2023
1 parent a800b65 commit 912cf4f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 15 deletions.
14 changes: 14 additions & 0 deletions core/Menu/MenuAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ public function addPlatformItem($menuName, $url, $order = 50, $tooltip = false)
$this->addItem('CorePluginsAdmin_MenuPlatform', $menuName, $url, $order, $tooltip);
}

/**
* See {@link add()}. Adds a new menu item to the plugins section of the admin menu.
* @param string $menuName
* @param array $url
* @param int $order
* @param bool|string $tooltip
* @api
* @since 5.0.0
*/
public function addPluginItem(string $menuName, array $url, int $order = 50, $tooltip = false)
{
$this->addItem('General_Plugins', $menuName, $url, $order, $tooltip);
}

/**
* See {@link add()}. Adds a new menu item to the measurable section of the admin menu.
* @param string $menuName
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
"PleaseUpgradeYourPhpVersionSoYourPiwikDataStaysSecure": "Please upgrade your PHP version to at least PHP %s so your Matomo analytics data stays secure.",
"Plugin": "Plugin",
"Plugins": "Plugins",
"PluginSubscriptions": "Plugin Subscriptions",
"ManageSubscriptions": "Manage Subscriptions",
"PoweredBy": "Powered by",
"Previous": "Previous",
"PreviousDays": "Previous %s days (not including today)",
Expand Down
13 changes: 7 additions & 6 deletions plugins/CoreAdminHome/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ class Menu extends \Piwik\Plugin\Menu
{
public function configureAdminMenu(MenuAdmin $menu)
{
$menu->addPersonalItem(null, array(), 1, false);
$menu->addSystemItem(null, array(), 2, false);
$menu->addMeasurableItem(null, array(), $order = 3);
$menu->addPlatformItem(null, array(), 4, false);
$menu->addDiagnosticItem(null, array(), $order = 5);
$menu->addDevelopmentItem(null, array(), $order = 40);
$menu->addPersonalItem('', [], 1);
$menu->addSystemItem('', [], 2);
$menu->addPluginItem('', [], 3);
$menu->addMeasurableItem('', [], 4);
$menu->addPlatformItem('', [], 5);
$menu->addDiagnosticItem('', [], 6);
$menu->addDevelopmentItem('', [], 40);

if (Piwik::hasUserSuperUserAccess()) {
$menu->addSystemItem('General_GeneralSettings',
Expand Down
5 changes: 2 additions & 3 deletions plugins/CorePluginsAdmin/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ public function configureAdminMenu(MenuAdmin $menu)
}

if ($hasSuperUserAccess) {
$menu->addSystemItem(Piwik::translate('General_ManagePlugins') . $pluginsUpdateMessage,
$this->urlForAction('plugins', array('activated' => '')),
$order = 20);
$menu->addPluginItem(Piwik::translate('General_ManagePlugins') . $pluginsUpdateMessage,
$this->urlForAction('plugins', array('activated' => '')), 10);
}
}

Expand Down
8 changes: 4 additions & 4 deletions plugins/Marketplace/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public function configureAdminMenu(MenuAdmin $menu)
{
if (!Piwik::isUserIsAnonymous()) {
$menu->addPlatformItem('Marketplace_Marketplace',
$this->urlForAction('overview', array('activated' => '', 'mode' => 'admin', 'type' => '', 'show' => '')),
$order = 5);
$this->urlForAction('overview', ['activated' => '', 'mode' => 'admin', 'type' => '', 'show' => '']),
5);
}

if (Piwik::hasUserSuperUserAccess()) {
$menu->addSystemItem(Piwik::translate('General_PluginSubscriptions'),
$menu->addPluginItem(Piwik::translate('General_ManageSubscriptions'),
$this->urlForAction('subscriptionOverview'),
$order = 21);
20);
}
}

Expand Down
1 change: 1 addition & 0 deletions plugins/Morpheus/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function configureAdminMenu(MenuAdmin $menu)
$menu->registerMenuIcon('CoreAdminHome_MenuDiagnostic', 'icon-admin-diagnostic');
$menu->registerMenuIcon('CorePluginsAdmin_MenuPlatform', 'icon-admin-platform');
$menu->registerMenuIcon('General_Settings', 'icon-admin-settings');
$menu->registerMenuIcon('General_Plugins', 'icon-plugin');
$menu->registerMenuIcon('CoreAdminHome_Administration', 'icon-settings');
$menu->registerMenuIcon('UsersManager_MenuPersonal', 'icon-user-personal');
$menu->registerMenuIcon('CoreAdminHome_MenuSystem', 'icon-server');
Expand Down
2 changes: 1 addition & 1 deletion plugins/PrivacyManager/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function configureAdminMenu(MenuAdmin $menu)
if (Piwik::isUserHasSomeAdminAccess()) {
$category = 'PrivacyManager_MenuPrivacySettings';
$menu->registerMenuIcon($category, 'icon-locked');
$menu->addItem($category, null, array(), 2);
$menu->addItem($category, null, [], 3);

if (Piwik::hasUserSuperUserAccess()) {
$menu->addItem($category, 'PrivacyManager_AnonymizeData', $this->urlForAction('privacySettings'), 5);
Expand Down

0 comments on commit 912cf4f

Please sign in to comment.