Skip to content

Commit

Permalink
[4.x] Move plugin related sub menu items to new Plugins menu item (#2…
Browse files Browse the repository at this point in the history
…1609)

* Move plugin related sub menu items to new Plugins menu item

* add plugin icon to font

* add missing translation

* updates expected UI test files

* submodule update

* updates expected UI test files
  • Loading branch information
sgiehl authored Dec 1, 2023
1 parent 541997d commit 3415acf
Show file tree
Hide file tree
Showing 53 changed files with 139 additions and 90 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: 2 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@
"PleaseUpgradeYourPhpVersionSoYourPiwikDataStaysSecure": "Please upgrade your PHP version to at least PHP %s so your Matomo analytics data stays secure.",
"Plugin": "Plugin",
"Plugins": "Plugins",
"ManageSubscriptions": "Manage Subscriptions",
"ManagePlugins": "Manage Plugins",
"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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 11 additions & 7 deletions plugins/CorePluginsAdmin/Menu.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/

namespace Piwik\Plugins\CorePluginsAdmin;

use Piwik\Container\StaticContainer;
Expand Down Expand Up @@ -45,13 +47,13 @@ public function configureTopMenu(MenuTop $menu)

public function configureAdminMenu(MenuAdmin $menu)
{
$hasSuperUserAcess = Piwik::hasUserSuperUserAccess();
$hasSuperUserAccess = Piwik::hasUserSuperUserAccess();
$isAnonymous = Piwik::isUserIsAnonymous();
$isMarketplaceEnabled = Marketplace::isMarketplaceEnabled();

$pluginsUpdateMessage = '';

if ($hasSuperUserAcess && $isMarketplaceEnabled && $this->marketplacePlugins) {
if ($hasSuperUserAccess && $isMarketplaceEnabled && $this->marketplacePlugins) {
$pluginsHavingUpdate = $this->marketplacePlugins->getPluginsHavingUpdate();

if (!empty($pluginsHavingUpdate)) {
Expand All @@ -60,13 +62,15 @@ public function configureAdminMenu(MenuAdmin $menu)
}

if (!$isAnonymous) {
$menu->addPlatformItem(null, "", $order = 7);
$menu->addPlatformItem('', [], 7);
}

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

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions plugins/Marketplace/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +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->addPluginItem(Piwik::translate('General_ManageSubscriptions'),
$this->urlForAction('subscriptionOverview'),
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
Binary file modified plugins/Morpheus/fonts/matomo.eot
Binary file not shown.
1 change: 1 addition & 0 deletions plugins/Morpheus/fonts/matomo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified plugins/Morpheus/fonts/matomo.ttf
Binary file not shown.
Binary file modified plugins/Morpheus/fonts/matomo.woff
Binary file not shown.
Binary file modified plugins/Morpheus/fonts/matomo.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion plugins/Morpheus/fonts/selection.json

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions plugins/Morpheus/fonts/svgs/icon-plugin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions plugins/Morpheus/stylesheets/base/icons.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {
font-family: 'matomo';
src:
url('plugins/Morpheus/fonts/matomo.woff2?19vk91') format('woff2'),
url('plugins/Morpheus/fonts/matomo.woff?19vk91') format('woff'),
url('plugins/Morpheus/fonts/matomo.ttf?19vk91') format('truetype'),
url('plugins/Morpheus/fonts/matomo.svg?19vk91#matomo') format('svg');
url('plugins/Morpheus/fonts/matomo.woff2?sbh6bh') format('woff2'),
url('plugins/Morpheus/fonts/matomo.woff?sbh6bh') format('woff'),
url('plugins/Morpheus/fonts/matomo.ttf?sbh6bh') format('truetype'),
url('plugins/Morpheus/fonts/matomo.svg?sbh6bh#matomo') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
Expand Down Expand Up @@ -433,3 +433,6 @@
.icon-marketplace:before {
content: "\e90b";
}
.icon-plugin:before {
content: "\e90c";
}
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-4');
$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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/UI/expected-screenshots/Menus_admin_loaded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/UI/expected-screenshots/Menus_admin_websites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3415acf

Please sign in to comment.