0

I would like to add module On/Off option in Configuration for custom extension.

I have used below code and add into my system.xml but when I select option No module is not off.

<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
       <label>Enabled</label>
       <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>

Is there any anther code I have to do in other file ?

Or is there wrong in this code ?

  • Have you remove var/generataion folder – Rakesh Jesadiya Aug 4 '17 at 8:55
  • Still not working. – Hitesh Vaghasiya Aug 4 '17 at 9:01
  • are you add condition in xml file ifconfig="sectionid/groupid/fieldid" – Sagar Dobariya Aug 4 '17 at 9:59
1

Try below snippet:

<group id="test" translate="label" type="text" sortOrder="350" showInDefault="1" showInWebsite="1" showInStore="0">
    <label>Your Title</label>
    <field id="enable_module" translate="label" type="select" showInDefault="1" canRestore="1">
        <label>Enabled</label>
        <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
    </field>
</group>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.