diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-05-20 02:07:40 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-05-20 02:07:40 +0400 |
commit | 009a6f21177e8cb6366577d8f54024e896bb0d8e (patch) | |
tree | 70edeaf31d0b59acff6f22f47e1847349bc6728c /plugins/ExampleUI | |
parent | 84a7e582a45a8c65b34035819a23c6e1b59794be (diff) |
refs #5192 starting a little Menu refactoring
Diffstat (limited to 'plugins/ExampleUI')
-rw-r--r-- | plugins/ExampleUI/ExampleUI.php | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/plugins/ExampleUI/ExampleUI.php b/plugins/ExampleUI/ExampleUI.php index a9b3a83104..d9204abca8 100644 --- a/plugins/ExampleUI/ExampleUI.php +++ b/plugins/ExampleUI/ExampleUI.php @@ -8,6 +8,7 @@ */ namespace Piwik\Plugins\ExampleUI; +use Piwik\Menu\MenuAbstract; use Piwik\Menu\MenuMain; use Piwik\Menu\MenuTop; @@ -26,30 +27,30 @@ class ExampleUI extends \Piwik\Plugin ); } - function addReportingMenuItems() + function addReportingMenuItems(MenuAbstract $menu) { - MenuMain::getInstance()->add('UI Framework', '', array('module' => 'ExampleUI', 'action' => 'dataTables'), true, 30); + $menu->add('UI Framework', '', array('module' => 'ExampleUI', 'action' => 'dataTables'), true, 30); - $this->addSubMenu('Data tables', 'dataTables', 1); - $this->addSubMenu('Bar graph', 'barGraph', 2); - $this->addSubMenu('Pie graph', 'pieGraph', 3); - $this->addSubMenu('Tag clouds', 'tagClouds', 4); - $this->addSubMenu('Sparklines', 'sparklines', 5); - $this->addSubMenu('Evolution Graph', 'evolutionGraph', 6); + $this->addSubMenu($menu, 'Data tables', 'dataTables', 1); + $this->addSubMenu($menu, 'Bar graph', 'barGraph', 2); + $this->addSubMenu($menu, 'Pie graph', 'pieGraph', 3); + $this->addSubMenu($menu, 'Tag clouds', 'tagClouds', 4); + $this->addSubMenu($menu, 'Sparklines', 'sparklines', 5); + $this->addSubMenu($menu, 'Evolution Graph', 'evolutionGraph', 6); if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('TreemapVisualization')) { - $this->addSubMenu('Treemap', 'treemap', 7); + $this->addSubMenu($menu, 'Treemap', 'treemap', 7); } } - function addTopMenuItems() + function addTopMenuItems(MenuTop $menu) { $urlParams = array('module' => 'ExampleUI', 'action' => 'notifications'); - MenuTop::getInstance()->addEntry('UI Notifications', $urlParams, $displayedForCurrentUser = true, $order = 3); + $menu->addEntry('UI Notifications', null, $urlParams, $displayedForCurrentUser = true, $order = 3); } - private function addSubMenu($subMenu, $action, $order) + private function addSubMenu(MenuAbstract $menu, $subMenu, $action, $order) { - MenuMain::getInstance()->add('UI Framework', $subMenu, array('module' => 'ExampleUI', 'action' => $action), true, $order); + $menu->add('UI Framework', $subMenu, array('module' => 'ExampleUI', 'action' => $action), true, $order); } } |