diff options
author | Ben Burgess <88810029+bx80@users.noreply.github.com> | 2021-12-22 23:26:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-22 23:26:51 +0300 |
commit | d68dc6dd06606e8a7611c53d8ee63da8afbf99f7 (patch) | |
tree | b0363d254677ec77d42ff75352992405b41aef81 /core/Menu/MenuAbstract.php | |
parent | 10afd46db0e033e67127fb4e50eea986ed5296e6 (diff) |
Show a summary of new features (#18065)
* Added "What is new" notification display, populated by a new event
* Removed test example event hook
* Added support for applying a link attribute to menu items, fixes layout issue for mobile with html menu items
* Updated UI test screenshots
* Revert accidental edit
* Hide the "What's new" icon if there are no new features to show
* Changed to use changes.json, track user last viewed, added ui test
* Fix UserManager unit tests broken by new ts_changes_viewed user field
* Moved getChanges to separate helper class, added unit test, added user view access check
* Updated to add new changes table and populate only on plugin update/install
* Added missing fixture class, updated UI screenshots
* Updated matomo font to add ringing bell and new releases icons
* Fix for integration test
* Reworked class structure, removed unnecessary angular directive, merged templates, other tidy ups
* built vue files
* built vue files
* Added null user check, missing table exception handling, show plugin name in change title, better handling of missing change fields
* Added sample changes file, moved UserChanges db code to changes model, added return type hints, better db error code handling, various other improvements
* Revert accidental UI screenshot commit
* Fix for incorrect link name parameter in sample changes, switched back to using $db->query for INSERT IGNORE
* Integration test fix, UI screenshot updates
* Test fix
* Added link styling, show CoreHome changes without plugin prefix in title
* Update UI test screenshot
* Added styles to the popover, added event for filtering changes
* Test fix
* UI test screenshot updates
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: bx80 <bx80@users.noreply.github.com>
Diffstat (limited to 'core/Menu/MenuAbstract.php')
-rw-r--r-- | core/Menu/MenuAbstract.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php index 2783d7f48d..5a276dce2e 100644 --- a/core/Menu/MenuAbstract.php +++ b/core/Menu/MenuAbstract.php @@ -98,10 +98,11 @@ abstract class MenuAbstract extends Singleton * @param bool|string $tooltip An optional tooltip to display or false to display the tooltip. * @param bool|string $icon An icon classname, such as "icon-add". Only supported by admin menu * @param bool|string $onclick Will execute the on click handler instead of executing the link. Only supported by admin menu. + * @param string $attribute Will add this string as a link attribute. * @since 2.7.0 * @api */ - public function addItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false, $icon = false, $onclick = false) + public function addItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false, $icon = false, $onclick = false, $attribute = false) { // make sure the idSite value used is numeric (hack-y fix for #3426) if (isset($url['idSite']) && !is_numeric($url['idSite'])) { @@ -116,7 +117,8 @@ abstract class MenuAbstract extends Singleton $order, $tooltip, $icon, - $onclick + $onclick, + $attribute ); } @@ -144,7 +146,7 @@ abstract class MenuAbstract extends Singleton * @param int $order * @param bool|string $tooltip Tooltip to display. */ - private function buildMenuItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false, $icon = false, $onclick = false) + private function buildMenuItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false, $icon = false, $onclick = false, $attribute = false) { if (!isset($this->menu[$menuName])) { $this->menu[$menuName] = array( @@ -158,17 +160,22 @@ abstract class MenuAbstract extends Singleton $this->menu[$menuName]['_order'] = $order; $this->menu[$menuName]['_name'] = $menuName; $this->menu[$menuName]['_tooltip'] = $tooltip; + $this->menu[$menuName]['_attribute'] = $attribute; if (!empty($this->menuIcons[$menuName])) { $this->menu[$menuName]['_icon'] = $this->menuIcons[$menuName]; } else { $this->menu[$menuName]['_icon'] = ''; } + if (!empty($onclick)) { + $this->menu[$menuName]['_onclick'] = $onclick; + } } if (!empty($subMenuName)) { $this->menu[$menuName][$subMenuName]['_url'] = $url; $this->menu[$menuName][$subMenuName]['_order'] = $order; $this->menu[$menuName][$subMenuName]['_name'] = $subMenuName; $this->menu[$menuName][$subMenuName]['_tooltip'] = $tooltip; + $this->menu[$menuName][$subMenuName]['_attribute'] = $attribute; $this->menu[$menuName][$subMenuName]['_icon'] = $icon; $this->menu[$menuName][$subMenuName]['_onclick'] = $onclick; $this->menu[$menuName]['_hasSubmenu'] = true; @@ -185,7 +192,7 @@ abstract class MenuAbstract extends Singleton private function buildMenu() { foreach ($this->menuEntries as $menuEntry) { - $this->buildMenuItem($menuEntry[0], $menuEntry[1], $menuEntry[2], $menuEntry[3], $menuEntry[4], $menuEntry[5], $menuEntry[6]); + $this->buildMenuItem($menuEntry[0], $menuEntry[1], $menuEntry[2], $menuEntry[3], $menuEntry[4], $menuEntry[5], $menuEntry[6], $menuEntry[7]); } } |