Magento Expert Forum - Improve your Magento experience

Results 1 to 4 of 4

How To Add Custom Admin Menu In Magento 2

  1. #1
    Junior Member fay_khattak's Avatar
    Join Date
    Jan 2016
    Location
    Karachi, Pakistan
    Posts
    37
    Thanks
    0
    Thanked 1 Time in 1 Post

    Lightbulb How To Add Custom Admin Menu In Magento 2

    Magento developers look forward to new and modern features in Magento 2 to get the most out of the popular CMS right out-of-the-box. When we talk about Magento 2 ecommerce development, there is always a need for custom options that are required to be placed somewhere in the platform.

    While creating a Magento 2 module, I needed to add a custom admin menu in the Magento 2 Admin Panel. To solve this issue, I spent some time on it and found a solution. In this blog post, I tried to describe how to add a custom admin menu in Magento 2 briefly.

    View more threads in the same category:


  2. #2
    Junior Member
    Join Date
    Aug 2016
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default

    Create admin menu file called: menu.xml file

    app/code/Mageplaza/HelloWorld/etc/adminhtml/menu.xml

    with the following content:

    <?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>
    </menu>
    </config>

    Step 2: Add menu item


    <?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="Mageplaza_HelloWorld::helloworld" title="Hello World" module="Mageplaza_HelloWorld" sortOrder="51" resource="Mageplaza_HelloWorld::helloworld"/>
    <add id="Mageplaza_HelloWorld:ost" title="Posts" module="Mageplaza_HelloWorld" sortOrder="10" action="mageplaza_helloworld/post" resource="Mageplaza_HelloWorld:ost" parent="Mageplaza_HelloWorld::helloworld"/>
    <add id="Mageplaza_HelloWorld::hello_configuration" title="Configuration" module="Mageplaza_HelloWorld" sortOrder="99" parent="Mageplaza_HelloWorld::helloworld" action="adminhtml/system_config/edit/section/helloworld" resource="Mageplaza_HelloWorld::helloworld_configu ration"/>
    </menu>
    </config>

    In this example, we will create a level-0 menu named “Hello World” and two sub-menus named “Manage Items” and “Configuration”. The menu.xml file will define a collection of ‘add’ note which will add a menu item to Magento backend. We will see its structure:

    <add id="Mageplaza_HelloWorld:ost" title="Posts" module="Mageplaza_HelloWorld" sortOrder="10" action="mageplaza_helloworld/post" resource="Mageplaza_HelloWorld:ost" parent="Mageplaza_HelloWorld::helloworld"/>

    Step 3: Flush Magento cache

    Make sure it admin menu items are displayed on Magento 2 admin, you should try to flush Magento 2 cache.

    Run the following command line:

    php bin/magento cache:clean

  3. #3
    Junior Member
    Join Date
    Sep 2016
    Posts
    83
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Simply follow these steps:

    To Create Admin Menu in Magento 2

    Step 1: Create menu.xml
    Step 2: Add menu item
    Step 3: Flush Magento cache


    Small Business for Sale | Business for Sale in Delhi

  4. #4

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •