8

I have tried to set dependency for configuration setting of magento 2 but not able to set. So, How can I put dependency in system.xml file in magento2 for configuration?

9

To create dependent object in system.xml following syntax will work that you have to put in field tag of yours and "id" will be field`s id on which your field is depend.

<depends>
    <field id="enabled">1</field>
</depends>

Multiple Dependency:

<field id="text" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Your Field</label>
    <depends>
        <field id="id_of_depend_field" separator=",">1,3</field>
    </depends>
</field>
  • Thanks for you kind help. It is same as magento 1 but with small changes. I have tried to find but does not got right syntax. :) – Bhargav Joshi Dec 29 '15 at 13:15

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.