Allow removeField() on contextual field names (#790)

The addFields() method already filters out fields that don't match the current context. As such, the normalized field name should be used when adding the field to the tab containers instead of the name with the context included. This matches the definition in allFields.
This commit is contained in:
Damien MATHIEU 2022-12-13 15:09:46 +01:00 committed by GitHub
parent f61da3e800
commit 864d3fbdcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -736,13 +736,13 @@ class Form extends WidgetBase
switch (strtolower($addToArea)) {
case FormTabs::SECTION_PRIMARY:
$this->allTabs->primary->addField($name, $fieldObj, $fieldTab);
$this->allTabs->primary->addField($fieldObj->fieldName, $fieldObj, $fieldTab);
break;
case FormTabs::SECTION_SECONDARY:
$this->allTabs->secondary->addField($name, $fieldObj, $fieldTab);
$this->allTabs->secondary->addField($fieldObj->fieldName, $fieldObj, $fieldTab);
break;
default:
$this->allTabs->outside->addField($name, $fieldObj);
$this->allTabs->outside->addField($fieldObj->fieldName, $fieldObj);
break;
}
}