Layout rules
This page is for designers who wonder why a page shows a certain layout. Rules (called mappings in the editor) decide it. Full reference: Exponential Layouts, "Rules".
Contents
A rule
A rule has a layout, targets, conditions, a priority and an enabled switch. The resolver
(expLayoutsResolver::resolve()) walks the enabled rules by priority and returns the first published layout whose rule
matches the request.
Targets
| Type | Matches when |
|---|---|
path_prefix | the request path starts with the value |
path | the path equals the value |
path_regex | the path matches a regular expression |
node | the request is this content node |
subtree | the request's node is below this location |
subtree survives an editor renaming a folder; a path_prefix does not.
Conditions
| Type | Restricts by |
|---|---|
siteaccess | the siteaccess serving the page |
content_type / class | the content class of the node |
query_parameter, route_parameter | a parameter in the URL |
time | a date range (campaign layouts that switch themselves on and off) |
An unknown condition type matches rather than fails, so a typo widens a rule instead of disabling it.
First match wins
When a layout does not appear, a broader rule with a higher priority usually catches the page first. Look at the priorities before anything else.
Debugging the layout of a page
- In a template:
fetch( 'explayouts', 'rules_for_node', hash( 'node_id', $node.node_id ) )lists the rules that match a node, andfetch( 'explayouts', 'resolve_layout_for_node', hash( 'node_id', ... ) )returns the layout it would get (extension/explayouts/modules/explayouts/function_definition.php). - The resolver caches its result per path under
var/<site>/cache/explayouts/resolver/withexplayouts.ini [ResolverSettings] CacheTTL(3600 seconds). Publishing in the editor clears it; a rule changed directly in the database does not. [ResolverSettings] DefaultLayoutnames the layout used when no rule matches, if any.
Related pages
- Layouts for designers
- Fetching a layout in templates
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.