4

I want to add section (menu items group) into adminhtml menu in Magento 2. Something like this:

adminhtml menu sesions

I've added file ./etc/adminhtml/menu.xml with:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Vendor_Module::section"
             title="Section"
             translate="title"
             module="Vendor_Module"
             sortOrder="50"
             resource="Vendor_Module::section"/>
    </menu>
</config>

but I cannot see new section in the adminhtml menu.

  • Can you please update your whole menu.xml code? – Rutvee Sojitra Aug 22 '18 at 12:31
5

please update your menu.xml like below:

 <?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
    <add id="Vendor_Module::section" title="Section"  module="Vendor_Module" sortOrder="50" resource="Vendor_Module::section"/>   
    <add id="Vendor_Module::section-subsection"  title="Section"  module="Vendor_Module" sortOrder="50" resource="Vendor_Module::section" action="section/index/index"  parent="Vendor_Module::section"/>    
</menu>
</config>

If is still not display please confirm that your module is enable

4

Please add like this in menu.xml

<menu>
    <add id="Test_Menu::parent" title="Menu" module="Test_Menu" sortOrder="100" resource="Test_Menu::parent"/>
        <add id="Test_Menu::test" title="First Menu" module="Test_Menu" sortOrder="11" action="router/controller/action" resource="Test_Menu::test" parent="Test_Menu::parent"/>

3

Add this below the <add> tag

<add id="Vendor_Module::section2"
             title="Section2"
             translate="title2"
             module="Vendor_Module"
             sortOrder="55"
    parent="Vendor_Module::section" action="vendor/module"
             resource="Vendor_Module::section"/>
0

In the menu.xml file use code as below

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Vendor_Module::section" title="Section"  module="Vendor_Module" sortOrder="50" resource="Vendor_Module::section"/>   
        <add id="Vendor_Module::subsection" title="Subsection"  module="Vendor_Module" sortOrder="50" resource="Vendor_Module::subsection" action="{routname}/{pathtocontroller}"  parent="Vendor_Module::section"/>    
    </menu>
</config>

change {routname}/{pathtocontroller} with path of your controller.

Also, confirm that your module is enabled by

php bin/magento module:status

if disable you can enable it by

php bin/magento module:enable Vendor_Module

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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