How to create custom admin menu in magento 2 step by step | Easy Tutorial | Complete Guide
In this video tutorial we going to see how to create admin menu in magento 2.
magento 2 create module tutorial
magento module development tutorial
module development in magento 2
custom module in magento 2
how to create module in magento 2 step by step
how to create module in magento 2
how to create module in magento
How to add a link to Magento 2 Admin Menu, which shown on the left side of Admin Menu pages of Magento 2.
Firstly, we will find out the structure of the admin menu and how the action in each menu like. The structure of the menu is separated by level. You will see the level-0 on the left bar and the higher level is grouped and shown when you click on level-0 menu. For example, this image is a menu of Stores. You will see the Stores is a level-0 and show on the left bar. When you click on it, the sub-menu will show up like: Setting, Attributes, Taxes… and that sub-menu has some sub-sub-menu also (Setting has All Stores, Configuration, Terms and Conditions, Order Status).
Like on the frontend, we will have this format {router_name}_{controller_folder}_{action_name}. But in the admin menu, we will have a admin router name (this can be customized) before which made Magento know this’s a Backend area.
In Magento 2, we use the menu.xml to add this menu.
To understand more about menu in magento 2 we will do practice.
Lets do this practically, you need to follow step by step
Step 1: Create a new module called Techone_ Adminmenu
- Create the namespace Techone in the path app\code.
- Create the module name Adminmenu in the path app\code\Techone.
- Create the file named registration.php in the path app\code\Techone\ Adminmenu
- Create the file name module.xml in the path app\code\Techone\ Adminmenu\etc
End of step #1, I have been completed the step to create new module called Techone_ Adminmenu
Step 2: Declare Route
- Route will define name for a module which can use in url to find the url and execute the controller action.
- Create the new file named routes.xml in the path app\code\Techone\Adminmenu\etc\adminhtml
I put the routes.xml file in the folder named adminhtml, because I want these codes only to apply on the admin.
Step 3: Create menu.xml
- Create the new file named menu.xml, in the path app\code\Techone\Adminmenu\etc\adminhtml\menu.xml
In this example, we will create a level-0 menu named “Techone” and two sub-menus named “Manage Posts” and “Configuration”. The menu.xml file will define a collection of ‘add’ note which will add a menu item to Magento backend.
Step 4: Test and see the results
Run the command lines following:
- php bin/magento setup:upgrade
- php bin/magento setup:static-content:deploy -f
- php bin/magento cache:flush –done
Other Videos By Raju Pandit
Other Statistics
Step By Step Statistics For Raju Pandit
Raju Pandit presently has 3,619 views for Step By Step across 3 videos, with his channel publishing less than an hour of Step By Step content. This makes up 3.45% of the content that Raju Pandit has uploaded to YouTube.