Magento 2 Add a menu item in backend

In this blog post we will see how to add a menu item in backend for your Magento 2 module.

1. Create file VendorName/ModuleName/etc/menu.xml

The admin menu in Magento 2 has 3 parts:

  • The main admin menu title which shows up in left sidebar
  • Submenu title
  • Actual menu

2. Create file VendorName/ModuleName/etc/acl.xml

3. Create Admin Routes with file: VendorName/ModuleName/etc/adminhtml/routes.xml

with content:

4. Create a backend controller to handle menu item url

VendorName/ModuleName/Controller/Adminhtml/World/Index.php

Finally, when you click on the new menu item, you will see “Hello World” in a page.

If something is wroing, you will be redirected to dashboard automatically.

That’s how to add a menu item in backend Magento 2, see you in other posts.

Leave a Reply

Your email address will not be published.