Here, we will learn how to hide the admin menu based on the module enable and disable from system configuration.
Follow the below steps to achieve this:
Add the below code into your existing menu.xml
File path: app\code\Vendor\Extension\etc\adminhtml\menu.xml
<?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_Extension::extensionmenu" title=" Extension Menu" module="Vendor_Extension" sortOrder="10" resource="Vendor_Extension::mainmenu" dependsOnConfig="section/group/field"/>
</menu>
</config>
let us know via the comment box if you need any help on this, we will be happy to solve it! Do share the article with your friends and stay updated with us.