Detail
#24407
Layout refactoring: restructure (admin) layouts so that .layout.xml and component XML are adjacent
The new form of layout definition (see #23037, LayoutStructure) has the consequence that (at least for migrated layouts) two layout files exist per content view (the generated top-level layout file(*.layout.xml) and the previous component XML file *.xml). In this case, the layout XML file binds the component XML file via the indirection of a layout template. Due to the generation heuristics, both files are usually not adjacent, but are located in completely different subtrees.
The (administrative) layout definitions provided by the base are to be adapted to meet the layout structure conventions in LayoutStructure.
Code migration
Replace the per-application independently defined administration structure with the administration(admin/index.layout.xml) inherited from the base components and adapt it with custom layout overlay files if necessary:
- Delete the WEB-INF/layouts/my.project.name folder created in the migration of #23037 with all its contents.
- Remove from the own layout.csv all administrative components inherited from the base (the admin tab may only contain layouts defined by the application itself). If the application has no own admin layouts, the admin tab remains empty.
- Regenerate the layout (Ant layout_setup).
- In masterFrame.layout.xml of the application add the line
<layout-reference resource="my.project.name/tl/admin/adminView.layout.xml"/>
by
<layout-reference resource="admin/index.layout.xml"/>
replace.
- Remove the layout.csv file (any further generation will destroy the new structure).
- Include own administrative components in the admin structure predefined by the base.
- To do this, create a *.layout.overlay.xml for the admin tab in the application where the administrative component of the application is to be inserted. See the following example.
To insert a component into the base administration, a file admin/base/index.layout.overlay.xml must be created in the application and filled with the following content:
admin/base/index.layout.overlay.xml:
#!xml <component> <component name="adminBaseView"> <components> <layout-reference resource="my.module.name/admin/my/component.layout.xml"/> </components> </component>
The masterFrame.layout.xml of the application should have the following structure:
#!xml <include name="templates/masterFrame.xml" ...> <components> <layout-reference resource="com.my.app/myFirstView.layout.xml"/> ... <layout-reference resource="com.my.app/myLastView.layout.xml"/> <layout-reference resource="admin/index.layout.xml"/> </components> </include>
Test
Refactoring, no additional test.