@digimantraoffice opened this issue on December 26th 2014

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 commented on January 4th 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!

This issue was closed on January 4th 2015
Powered by GitHub Issue Mirror