I have a custom module that displays a custom link in the footer section in frontend.
Further, I have created my module specific configurations in the admin panel.
I would like to add option to admin panel for Disable/Enable the link on frontend's footer.
How can I achieve this? Please help.
I have added the footer link in frontend in view/frontend/layout/default.xml
<referenceBlock name="footer_links">
<block class="Magento\Framework\View\Element\Html\Link\Current" name="Name">
<arguments>
<argument name="label" xsi:type="string">My custom link</argument>
<argument name="path" xsi:type="string">path/to/link</argument>
</arguments>
</block>
My system.xml is like,
<!--For creating section -->
<section id="quotes" translate="label" type="text" sortOrder="320" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Module</label>
<!--Assign section to tab -->
<tab>mytab</tab>
<resource>Vendor_Module::configuration</resource>
<!--create group for fields in section -->
<group id="quotes" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Group Name</label>
<!--create text type field -->
<field id="enabled" translate="label comment" sortOrder="7" type="select" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable the link</label>
<comment>select from the dropdown</comment>
<!-- source model which we created for drop down options -->
<source_model>Vendor\Module\Model\Config\Source\Module</source_model>
</field>
</group>
</referenceBlock>
The Vendor\Module\Model\Config\Source\Module contains,
/**
* @return array
*/
public function toOptionArray() {
return [
['value' => 'Yes', 'label' => __('Yes')],
['value' => 'No', 'label' => __('No')],
];
}