diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-09-06 14:16:37 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-09-06 14:16:37 +0400 |
commit | eee6ed99cf522e4e65df6618f5cd919a18da481b (patch) | |
tree | 5e7b017e408a9f9597868227919182db1f8c66f5 /plugins/ExamplePlugin | |
parent | 099c969cb987607437c6b7beabcd4e6883e5998d (diff) |
refs #6140 easier way to define URLs for menu items and introducing a method to addItem without boolean parameter
Diffstat (limited to 'plugins/ExamplePlugin')
-rw-r--r-- | plugins/ExamplePlugin/Menu.php | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/plugins/ExamplePlugin/Menu.php b/plugins/ExamplePlugin/Menu.php index 2a3ed266f2..b1fcde4eea 100644 --- a/plugins/ExamplePlugin/Menu.php +++ b/plugins/ExamplePlugin/Menu.php @@ -22,34 +22,37 @@ class Menu extends \Piwik\Plugin\Menu { public function configureReportingMenu(MenuReporting $menu) { - // with custom category 'UI Framework' - // $menu->add('UI Framework', '', array('module' => 'ExamplePlugin', 'action' => ''), true, $orderId = 30); - // $menu->add('UI Framework', 'Report 1', array('module' => 'ExamplePlugin', 'action' => 'report1'), true, $orderId = 30); - // or reusing an existing category - // $menu->addVisitorsItem('Report 1', array('module' => 'ExamplePlugin', 'action' => 'report1'), $orderId = 30); - // $menu->addActionsItem('Report 1', array('module' => 'ExamplePlugin', 'action' => 'report1'), $orderId = 30); + // reuse an existing category + // $menu->addVisitorsItem('Report 1', $this->urlForAction('report1'), $orderId = 30); + // $menu->addActionsItem('Report 1', $this->urlForAction('report1'), $orderId = 30); + + // or create a custom category 'UI Framework' + // $menu->addItem('UI Framework', '', $this->urlForDefaultAction(), $orderId = 30); + // $menu->addItem('UI Framework', 'Report 1', $this->urlForAction('report1'), $orderId = 30); } public function configureAdminMenu(MenuAdmin $menu) { - // with custom category - // $menu->add('General_Settings', 'My Admin Item', array('module' => 'ExamplePlugin', 'action' => ''), true, $orderId = 30); - // or reusing an existing category - // $menu->addSettingsItem('My Admin Item', array('module' => 'ExamplePlugin', 'action' => ''), $orderId = 30); - // $menu->addPlatformItem('My Admin Item', array('module' => 'ExamplePlugin', 'action' => ''), $orderId = 30); + // reuse an existing category + // $menu->addSettingsItem('My Admin Item', $this->urlForDefaultAction(), $orderId = 30); + // $menu->addPlatformItem('My Admin Item', $this->urlForDefaultAction(), $orderId = 30); + + // or create a custom category + // $menu->addItem('General_Settings', 'My Admin Item', $this->urlForDefaultAction(), $orderId = 30); } public function configureTopMenu(MenuTop $menu) { - // $menu->add('My Top Item', null, array('module' => 'ExamplePlugin', 'action' => ''), true, $orderId = 30); + // $menu->addItem('My Top Item', null, $this->urlForDefaultAction(), $orderId = 30); } public function configureUserMenu(MenuUser $menu) { - // with custom category - // $menu->add('CoreAdminHome_MenuManage', 'My User Item', array('module' => 'ExamplePlugin', 'action' => ''), true, $orderId = 30); - // or reusing an existing category - // $menu->addManageItem('My User Item', array('module' => 'ExamplePlugin', 'action' => ''), $orderId = 30); - // $menu->addPlatformItem('My User Item', array('module' => 'ExamplePlugin', 'action' => ''), $orderId = 30); + // reuse an existing category + // $menu->addManageItem('My User Item', $this->urlForDefaultAction(), $orderId = 30); + // $menu->addPlatformItem('My User Item', $this->urlForDefaultAction(), $orderId = 30); + + // or create a custom category + // $menu->addItem('CoreAdminHome_MenuManage', 'My User Item', $this->urlForDefaultAction(), $orderId = 30); } } |