1

I have been working on custom module in Magento 2 which will perform some kind of calculations on frontend. Now I need to port those modules into Admin, where user can see menu and module list. Clicking on that list, admin can see all modules developed so far under Vendor namespace. Below is the code to create admin menu.

<?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="Vendor_Namespace::helloworld" 
                title="Helloworld" 
                module="Vendor_Namespace" 
                sortOrder="51" 
                resource="Vendor_Namespace::helloworld"/>

       <add id="Vendor_Namespace::modulelist" 
                title="Concrete Calculator" 
                module="Vendor_Namespace" 
                sortOrder="1" 
                action="Vendor_Namespace/modulelist" 
                resource="Vendor_Namespace::modulelist" 
                parent="Vendor_Namespace::helloworld"/>
    </menu>
</config>

Module List

  1. How do I create Admin grid where clicking on Module List shows all the modules developed ?
  2. How can I add enable/disable button to any module, so that based on selection, that module is shown/hidden on frontend ?
  3. Do I need to create admin module separately or can I add menu.xml in custom module ?

P.S. Is it necessary to create SQL script for admin grid? The purpose is to show all custom module list in Admin and enable/disable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.