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
PayPal Checkout works too!
Commerce shop system from Drupal
nice find! the links for the most recently updated issues in the core and contrib queues are a great way to stay on top of things—especially now that the feature freeze is just around the corner...
Seeing what issues are new
A simple way — use Field Group to create a container for fields https://backdropcms.org/project/field_group and CSS Flex оr Grid to alignment. You can also create Fieldsets to...
Layout also for /node/add/ forms?