In the file menu.xml located in MyNamespace\Mymodule\etc\adminhtml\menu.xml, I understand that this file allows me to add new items to the navigation menu in admin panel.

In the <add> tags, there is an action attribute that contains values that look like something/somethingelse. For eg:

<add id="MyNamespace_MyModule::mymodule_testing" title="Some title" module="MyNamespace_MyModule" sortOrder="10" action="Part_A/Part_B" />

What should be entered in the Part_A and Part_B of the action attribute? I doubt they are arbitrary. What do they refer to and what do they stand for? What effects would it have if I put in a wrong thing into this attribute?

3 Answers 3


Let's say you have the following:

In your etc/adminhtml/routes.xml you declare the following route name:

<route id="hello" frontName="hello">
    <module name="Vendor_Module" />

Then under Controller/Adminhtml you have a folder called World

And finally in this World folder you have an action class called Grid.php

Then the action attribute to access this controller action class should be hello/world/grid

  • 2
    Ahh, this time Marius beats by few seconds :)
    – Keyur Shah
    Nov 18, 2016 at 9:34

the action part of the menu is the actual url of the menu item.
It should be module/controller/action or module/controller if the action is index.
take a look at this example from the core for the cms page menu link

<add id="Magento_Cms::cms_page" title="Pages" translate="title" module="Magento_Cms" sortOrder="0" parent="Magento_Backend::content_elements" action="cms/page" resource="Magento_Cms::page"/>

action looks like this: action="cms/page".
This means that the menu item is going to link to the cms module and the Page controller and index action.

the first part cms in this case, is the front name you declared in the adminhtml/routes.xml for your menu.
The second part is the name of the controller folder (lowercase) found int the Controller folder and the last part is the actual controller action file (lowercase and without the php extension) or it can be missing if the action name is index.

  • The first part is not necessarily module it could be anything defined in the routes.xml Nov 18, 2016 at 9:35
  • Your answer makes it sound like it is the module name all the time Nov 18, 2016 at 9:36
  • 3
    it usually is, but I changed that to make it more clear.
    – Marius
    Nov 18, 2016 at 9:37

The action attribute is the action which you want to do after clicking on that menu.you need to pass url over there front name/yourcontroller/action.

Lets take example of magento-catalog module.

<add id="Magento_Catalog::catalog_products" title="Catalog" translate="title" module="Magento_Catalog" sortOrder="10" parent="Magento_Catalog::inventory" action="catalog/product/" resource="Magento_Catalog::products"/>

Here action is catalog/product so catalog is the controller and product is the action and it will go tho that particular url and perform the action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.