respect depends declaration in system.xml for form element #3469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray class uses Magento_Config::system/config/form/field/array.phtml to render the form element. It is used e.g. to render design exceptions in the system configuration.
If you use the declaration within the system.xml for a form element and use a block class that relies on AbstractFieldArray as source_model the JavaScript to toggle the depending form elements (FormElementDependenceController) won't have any effect. In fact a JavaScript error is caused as no HTML element is found with the ID matching the name of form element.
The PR assigns the ID of the form element to the table surrounding the field array. That allows the FormElementDependenceController to toggle the form element according to the declaration.
While is not used with such form fields in the core it would increase reusability of the template file.