In this guide, we are going to show you how to create a custom admin menu in Magento 2.
The first step is to create a module.
Let’s give the module a name. Call it: Magemonkey_Newadminmenu
Then, create registration.php file
1 2 3 4 5 6 |
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Magemonkey_Newadminmenu', __DIR__ ); |
create module.xml file in etc/
1 2 3 4 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magemonkey_Newadminmenu" setup_version="1.0.0"></module> </config> |
create menu.xml file in etc/adminhtml/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?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="Magemonkey_Newadminmenu::first_menu" title="My Main Menu" module="Magemonkey_Newadminmenu" sortOrder="20" resource="Magento_Backend::content" /> <add id="Magemonkey_Newadminmenu::second_menu" title="My Sub Menu" module="Magemonkey_Newadminmenu" sortOrder="1" action="newadminmenu/index/index" parent="Magemonkey_Newadminmenu::first_menu" resource="Magento_Backend::content" /> </menu> </config> |
Know the description for element variables in code:
id: The unique identifier for the custom admin menu
title: The title will be shown as a menu name
Module: Magemonkey_Newadminmenu (name of the current module)
sortOrder: Set custom admin menu order
resource: The rule for admin users can access the custom admin menu
Action: Link for admin controller URL
parent: Name of the parent menu which custom menu depends on sub menu
After running this command for install that module
1 2 |
php bin/magento setup:upgrade php bin/magento cache:clean |
Now It will be shown in admin menu as seen in the below image.
[crayon-63e09f1ab9127024254266/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.