Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I can remove default menu Item from ReportingMenu #6901

Closed
digimantraoffice opened this issue Dec 26, 2014 · 1 comment
Closed

How I can remove default menu Item from ReportingMenu #6901

digimantraoffice opened this issue Dec 26, 2014 · 1 comment
Assignees
Labels
answered For when a question was asked and we referred to forum or answered it.
Milestone

Comments

@digimantraoffice
Copy link

Hi,

I tried to remove and rename the default Menu Item but unable to do, I'm developing a plugin which will create there custom menu so i need to remove and rename some of the default menu.

I use this guide : https://developer.piwik.org/api-reference/Piwik/Menu/MenuAbstract#remove

When I tried this remove() function on my created menu it works but when I tried same on default menu its not working at all.

     $menu->addItem('UI Framework', 'Report 1', $this->urlForAction('showList'), $orderId = 30);
     $menu->addItem('UI Framework', 'Report 2', $this->urlForAction('showList'), $orderId = 30);
     $menu->addItem('UI Framework', 'Report 3', $this->urlForAction('showList'), $orderId = 30);
     $menu->addItem('UI Framework', 'Report 4', $this->urlForAction('showList'), $orderId = 30);
     $menu->rename('Goals','Add a new Goal','Goalsss','Add Goal'); //Not Working
     $menu->remove('Goals');  //Not Working
     $menu->rename('UI Framework','','UI Frameworkss',''); // Working
@tsteur
Copy link
Member

tsteur commented Jan 4, 2015

You'll probably have to use the translation token of 'Goals' which is either Goals_EcommerceAndGoalsMenu in case ecommerce is enabled for a site or Goals_Goals if ecommerce is disabled.

Try

$menu->remove('Goals_EcommerceAndGoalsMenu');  
$menu->remove('Goals_Goals');  

I haven't tested it so let me know whether it works. If not, Piwik 2.10. might fix an issue related to the order of which plugins are loaded.

Removing menu items is a bit of a pain currently since one has to know the translation keys. We hope to improve this at some point!

@tsteur tsteur closed this as completed Jan 4, 2015
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Jan 4, 2015
@tsteur tsteur added this to the Piwik 2.10.0 milestone Jan 4, 2015
@tsteur tsteur self-assigned this Jan 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants