Wednesday, April 20, 2011

Removing an Item from Magento's Admin Panel Navigation

Using the Magento Ecommerce system, is is possible to remove an item from the Admin Panel Navigation menu? More generally, is there a way to use the config override system to remove existing elements from a configuration?

I know I can add to the navigation with an override that looks something like this

0.1.0

<adminhtml>
    <menu>
         <cms translate="title" module="cms">
            <title>The CMS</title>
            <sort_order>70</sort_order>
            <children>
                <foo translate="title" module="cms">
                    <title>Foo Item</title>
                    <action>adminhtml/foo</action>
                </foo>
            </children>
         </cms>
    </menu>    
</adminhtml>

but how would/could I completely suppress the CMS navigation item?

From stackoverflow
  • You could inject a bogus module dependency into the menu item in your config.xml.

    In your case,

    <adminhtml>
      <menu>
        <cms translate="title" module="cms">
          <depends><module>HideMe</module></depends>
        </cms>
      </menu>
    </adminhtml>
    
    Alan Storm : Your science impresses me! Will depends work like that in other areas of the config file? I'd only even seen it used to ensure correct module loading order.
    Scott Moorhouse : It seems to be only for initializing Magento's modules (as you stated) and building the adminhtml menu. Module dependencies seem to be checked in these classes: Mage_Adminhtml_Block_Page_Menu Mage_Adminhtml_Model_Config Mage_Adminhtml_Model_System_Config_Source_Admin_Page Mage_Api_Model_Config Mage_Core_Model_Config

0 comments:

Post a Comment