Hi i am new to magento and currently learning custom module for most viewed product and the module works great. now i have added a system.xml file below is the image.
system.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="netsmartz" translate="label" sortOrder="10">
<label>Netsmartz</label>
</tab>
<section id="mostviewed" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>Most Viewed</label>
<tab>netsmartz</tab>
<resource>Netsmartz_Mostviewed::mostviewed_config</resource>
<group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>General Configuration</label>
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Module Enable</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="display_text" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Module Name</label>
<comment>
Enable the module to get the most viewed sorting option in frontend
</comment>
</field>
</group>
</section>
</system>
</config>
config.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<Netsmartz_Mostviewed>
<general>
<use_cdn>1</use_cdn>
<display_text>Most Viewed</display_text>
</general>
</Netsmartz_Mostviewed>
</default>
</config>
now i want that when i hit module disable to no my module should be disable anyone have any idea how to achieve this. Thanks in Advance!