Description of the need
Using a Layout for a specifig path requires one to define at least 2 Layouts, if views pages are used.
- one for the base path (https://site-name/base-path)
- one for sub-paths (https://site-name/base-path/sub-paths)
The reason: views are not nodes.
As example: https://my-site/flowers/roses/wildroses
This consists of a base-path (flowers), a sub-path (roses) and a tirtiary path (wildroses).
For the whole tree, the same layout should be used:
- https://my-site/flowers (views-page)
- https://my-site/flowers/roses
- https://my-site/flowers/roses/wildroses
The base path (flowers) must be configured in the Path field, like:
- [https://site-name/] base-path (flowers)
The sub-paths (roses, roses/wildroses) have to be configured in the Path field too, but different, like:
- [https://site-name/] node/%
- Then a Visibility condition has to be added like: base-path/* (flowers/*)
The "Sub-Path" configuration does not work for the base path and vice versa.
For Sites with many layouts, the required effort is twice as much, as it could be.
If one adds classes for layouts to the pages, it complicates the things again. The CSS has to contain two class definitions for both, the base-path layout and the sub-paths layout.
Proposed solution
If the placeholder could be used alone as single element, without the need, to define a node. This should solve the problem. It could be used to define the base-path too.
- [https://site-name/] %
- Then a Visibility condition could be added like: base-path*
- A context entry for "path" would be required. (if no node is available)
Otherwise, if the path could be defined with wildcards in the Path field, like:
- [https://site-name/] base-path*
... like this is already used in visibility conditions ...
This would be the easiest solution.
Alternatives that have been considered
First I've tried the Layout Wildcard module, until I found out, this only can be used for multiple sub-paths or independent secondary paths, but not for any base-path.
Additional information
How to add classes for layouts to the pages HTML:
This can be done, modifying the themes template.php, here a sub theme of the Basic theme.
function sub_basic_preprocess_page(&$variables) {
$layout = layout_get_layout_by_path();
if ($layout) {
$variables['classes'][] = 'layout-' . $layout->name;
}
}
Draft of feature description for Press Release (1 paragraph at most)
Backdrop now simplyfies the configuration of Layouts.
Recent comments
@yorkshirepudding, In the end I fixed it by deleting the config/active folder contents, copying the config/staging/ files into config/active, importing the database again and clearing the caches...
Importing the staged config throws an error: another field with the same name already exists
Thanks, I have to go out now, I will try later on and report back
Importing the staged config throws an error: another field with the same name already exists
Hi Francis. Yes, what config do you have in staging for it? You might have configs like: field.field.field_video_embed field.instance.node.page....
Importing the staged config throws an error: another field with the same name already exists