From 009a6f21177e8cb6366577d8f54024e896bb0d8e Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Tue, 20 May 2014 00:07:40 +0200 Subject: refs #5192 starting a little Menu refactoring --- core/Menu/MenuAdmin.php | 11 ++++++++++- core/Menu/MenuMain.php | 2 +- core/Menu/MenuTop.php | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'core/Menu') diff --git a/core/Menu/MenuAdmin.php b/core/Menu/MenuAdmin.php index ee985314db..b187d18eba 100644 --- a/core/Menu/MenuAdmin.php +++ b/core/Menu/MenuAdmin.php @@ -42,12 +42,18 @@ class MenuAdmin extends MenuAbstract * current user. If false, the entry will not be added. * @param int $order The order hint. * @api + * @deprecated since version 2.3.0 */ public static function addEntry($adminMenuName, $url, $displayedForCurrentUser = true, $order = 20) { self::getInstance()->add('General_Settings', $adminMenuName, $url, $displayedForCurrentUser, $order); } + public function add($adminMenuName, $url, $displayedForCurrentUser = true, $order = 20) + { + parent::add('General_Settings', $adminMenuName, $url, $displayedForCurrentUser, $order); + } + /** * Triggers the Menu.MenuAdmin.addItems hook and returns the admin menu. * @@ -78,7 +84,7 @@ class MenuAdmin extends MenuAbstract * ); * } */ - Piwik::postEvent('Menu.Admin.addItems'); + Piwik::postEvent('Menu.Admin.addItems', array($this)); } return parent::getMenu(); } @@ -106,6 +112,9 @@ class MenuAdmin extends MenuAbstract return false; } + /** + * @deprecated since version 2.3.0 + */ public static function removeEntry($menuName, $subMenuName = false) { MenuAdmin::getInstance()->remove($menuName, $subMenuName); diff --git a/core/Menu/MenuMain.php b/core/Menu/MenuMain.php index 1900d0d28e..0421a33785 100644 --- a/core/Menu/MenuMain.php +++ b/core/Menu/MenuMain.php @@ -84,7 +84,7 @@ class MenuMain extends MenuAbstract * ); * } */ - Piwik::postEvent('Menu.Reporting.addItems'); + Piwik::postEvent('Menu.Reporting.addItems', array($this)); } return parent::getMenu(); } diff --git a/core/Menu/MenuTop.php b/core/Menu/MenuTop.php index 98d639b467..dcec860ac4 100644 --- a/core/Menu/MenuTop.php +++ b/core/Menu/MenuTop.php @@ -46,6 +46,7 @@ class MenuTop extends MenuAbstract * @param bool $isHTML Whether `$url` is an HTML string or a URL that will be rendered as a link. * @param bool|string $tooltip Optional tooltip to display. * @api + * @deprecated since version 2.3.0 */ public static function addEntry($topMenuName, $url, $displayedForCurrentUser = true, $order = 10, $isHTML = false, $tooltip = false) { @@ -56,6 +57,9 @@ class MenuTop extends MenuAbstract } } + /** + * @deprecated since version 2.3.0 + */ public static function removeEntry($menuName, $subMenuName = false) { MenuTop::getInstance()->remove($menuName, $subMenuName); @@ -114,7 +118,7 @@ class MenuTop extends MenuAbstract * ); * } */ - Piwik::postEvent('Menu.Top.addItems'); + Piwik::postEvent('Menu.Top.addItems', array($this)); } return parent::getMenu(); } -- cgit v1.2.3