In this post I am going to explain How to add Admin Menu in Magento 2
In Magento 2, we use the menu.xml to add the menu. Follow the steps to create Admin Menu in Magento 2.
Step 1: Create menu.xml on below path and add the below content.
Path: app/code/<vendor>/<module>/etc/adminhtml/menu.xml
1 2 3 4 5 6 | <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd"> <menu> </menu> </config> |
Step 2: Add Admin menu items
1 2 3 4 5 6 7 8 | <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd"> <menu> <add id="Vendor_Module::parent" title="Hiddentechies" module="Vendor_Module" sortOrder="70" resource="Vendor_Module::parent"/> <add id="Vendor_Module::items" title="Manage Items" module="Vendor_Module" sortOrder="10" parent="Vendor_Module::parent" action="module/items" resource="Vendor_Module::items"/> <add id="Vendor_Module::coniguration" title="Configuration" module="Vendor_Module" sortOrder="20" parent="Vendor_Module::parent" action="adminhtml/system_config/edit/section/coniguration" resource="Vendor_Module::coniguration"/> </menu> </config> |
In above example, we created a level-0 menu named “Hiddentechies” and two submenus named “Manage Items” and “Configuration”.
That’s it.
If you have any query about the above code then you can ask in the comment section below.
Thank You.
Leave a Reply