Display admin configuration field by other field text value
-
15-04-2021 - |
Pregunta
In Magento2 admin configuration we can display field conditionally like below,
<field id="do_3Dsecure" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Activate 3DS Authentication</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="enable_dynamic3DS2" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable 3DS2 Authentication</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<depends><field id="do_3Dsecure">1</field></depends>
</field>
It is Yes/No (1/0) and it is working fine with depends node. But in my case that dependant field is having text value, like below
<field id="integration_mode" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Integration Mode</label>
<source_model>Mymodule\Test\Worldpay\Model\Config\Source\IntegrationMode</source_model>
</field>
it is a dropdown field and it contains below below values
- direct
- redirect
So, is there any possible to display field based on this above text value by using depends node ?
Solución
Try this:
<depends><field id="integration_mode">direct</field></depends>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange