In current layout templates, many parameters must be filled for which there is a reasonable default (e.g. component names and resource prefixes). Both are derived from the layout file name.
Since components get qualified names (file name + local name), component names in templates can be constants(view, tab, editor, ...).
The convention for the resource prefix of a view is layouts.<name of view without .layout.xml>.... We would like to have this convention automatically, without writing the value to each file.
Application
Instead of
#!xml <include name="templates/levelOne.xml" componentName="tableTab" resPrefix="demo.table." > <inject> <tabInfo image="css:fas fa-table" label="demo.table.tabber" /> </inject> <components> <layout-reference resource="my.app/myView.layout.xml"/> ...
one would like to write, for example:
#!xml <include name="templates/tabbar.xml" tabIcon="css:fas fa-table" > <components> <layout-reference resource="my.app/myView.layout.xml"/> ...
To avoid having to assign explicit resource prefixes in a view, the calculated alias variable %LAYOUT_RESPREFIX% is available, which expands to an individual res prefix in each view, derived from the view name (path to the *.layout.xml file). This calculated alias is now used by default in the provided templates.
Migration
- Existing layout configurations must be migrated:
- Run Ant-Target update from the build script /com.top_logic/bin/compat/upgrade-layout-templates.xml.
- Normalize all layouts (target normalize_layouts from the application's build script).
- This migration now leaves unnecessary configurations in the application layouts (res prefix, component names) to simplify the migration. Such values are usually referenced from outside (test cases, translations). Settings that are no longer necessary are given the prefix z_legacy_.
Test
Refactoring, no additional test.