Search code examples
xmlmagentosystem.xml

Custom module conditional configuration optons


I would like to programmatically enable or disable specific options for a custom module on the administration panel depending on the status of a select. For example, if I had a Yes/No select something like

do you want to handle stuffs? < select yes/no >

and if stuffs == yes, then a number of other configuration fields would be enabled/visible. If stuffs != yes then those fields would be disabled/invisible.

Is that possible to do programmatically via system.xml/some-other-means, or it is a sci-fi dream?

Thanks for any help.


Solution

  • Yes, this is possible. You're interested in the <depends> tag in system.xml. You can read up about it here (self link). The general idea is you can make the appearance of a field depend on another field containing a specific value.