Is there a way I can disable my custom module according to the system config value? So that the user of my module can just disable the module from frontend by just setting it in admin configuration?
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="ccengine" translate="label" sortOrder="10">
<label>ccengine</label>
</tab>
<section id="ccengine" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<label>User Config</label>
<tab>ccengine</tab>
<resource>Faes_CCEngine::ccengine_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="url" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>URL</label>
<comment>URL given</comment>
</field>
<field id="token" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Token</label>
<comment>Token given</comment>
</field>
<field id="font_family" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Font Family</label>
<source_model>Faes\CCEngine\Model\Config\Source\Font</source_model>
<comment>Font Family on the frontend.</comment>
</field>
<field id="primary_color" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Primary Color</label>
<comment><![CDATA[Primary color]]></comment>
<frontend_model>Faes\CCEngine\Block\Color</frontend_model>
</field>
<field id="secondary_color" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Secondary Color</label>
<comment><![CDATA[Secondary color]]></comment>
<frontend_model>Faes\CCEngine\Block\Color</frontend_model>
</field>
</group>
</section>
</system>