Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 888
Matteo Avatar asked Apr 24 '26 13:04

Matteo


1 Answers

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.

like image 150
Alan Storm Avatar answered Apr 26 '26 14:04

Alan Storm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!