Top Magento Hosting Providers for 2018
Check'em Out

How to Create Custom Admin Menu in Magento 2

One important reason behind the success of Magento 2 is its excellent admin menu that offers a great mix of details to the users. However, there are times when store owners need to custom tailor the admin menu to fit their unique requirements.

Fortunately, Magento 2 allows the addition of custom admin menu items with ease. So, today in this guide, I am going to show you how to create a custom admin menu in Magento 2.

As always, following the best Magento development practices, I will create a custom module.

Configure the Module

To configure the custom module, create module.xml in app/code/Magenticians/Newmenu/etc and add the following to it:

Register the Module

To register your module, create registration.php in app/code/Magenticians/Newmenu and add the following to the file::

Create Custom Admin Menu

Now to create the custom admin menu for the Magento 2 store, create menu.xml file in app/code/Magenticians/Newmenu/etc/adminhtml and add the following code in it:

Now, here is a short description of the major variables in the above code:

id: The unique identifier of the custom admin menu.

title: The title that will be shown in the admin menu.

Module: in this case, Magenticians_Newmenu

sortOrder: Prioritize the placement of the custom admin menu.

resource: the rule to identify which admin users can access the custom admin menu.

Action: Set the link to the admin controller.

parent: Used to define the menu upon which the custom menu depends.

Launch the SSH Terminal

Launch the SSh terminal and go to the root directory of the Magneto 2 store. Now run the following commands:

It’s time to check the output. Go to the admin panel of your Magento 2 store, and you will see the new admin menu MY MAIN MENU with the nested My Sub Menu in it:

output - custom admin menu

Wrapping Up

After following this simple tutorial, I believe you can easily add custom admin menu to your Magento 2 store. Still facing any issues? Drop your query in the comment box below and I will get back to you!

 

About Author

Syed Muneeb Ul Hasan is an expert in PHP and Magento, he prefers to educate users in implementing and learning Magento. When not working, he loves to watch cricket.