Advanced options features
There are some features that you can add to the options to create a very modular and advanced configuration panel, such as the dependent field and the option to add JavaScripts inside the comment tag. Let's analyze these features.
A dependent field
One of the advanced features is the <depends>
tag to create dependent fields. When navigating the configuration of Magento, you may have noticed that sometimes when you you switch from Yes to No, some options disappear and if you select Yes, they reappear.
This is illustrated in the following screenshot:
In the preceding screenshot, you can see some options after the first one, and in the following screenshot, you can see that by selecting No, some options below it disappear:
The options disappear because that field depends on the first one. Any field can depend on another one.
To create a dependent file, you simply need to add the following code to one of the fields that you want to make visible or not:
<depends>...