major
nice-to-have
defect
major
minor
#23601
Delete nonsensical overrides of LayoutComponent.isDefaultFor(...)
Background
The EditPersonComponent overrides the LayoutComponent.isDefaultFor(String, BoundCommandGroup) method to register itself as the default component for the Person type. However, this method can only be used to register each instance of this component as the default component. If there is more than one instance, it is random which one opens. This behavior may change with every application startup.
In the demo, this means that clicking on a person sometimes opens the correct page in the administration interface, but sometimes opens a dialog in the "Technical Demo > Tests > PersonAjaxForm" view.
There is no other use case for this on TL Trunk.
Solution
This method should be removed. The default component is registered via its layout XML file, not via its code.
Code Migration
- Review all instances of a subclass of `EditPersonComponent ` and set the `defaultFor ` entry in the layout XML file accordingly:
- EditPersonComponent (and its subclasses) were the default for Person.
- EditCurrentPersonComponent had overridden this so that it (and its subclasses) are not the default for anything.
- Remove all overrides of ` LayoutComponent.isDefaultFor(...) ` and move them to the appropriate layout XML file.
Test
TestGotoDefaultForPerson.script.xml