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
This post explains how to do this in Drupal 7. In Backdrop, File Entity is already part of core. You will need to download and install module Views Field View. https://drupal.stackexchange...
I Need to Display an Image in a View that was Uploaded to a Webform
After alot of trials, i have done the obvious and translated the whole block for different languages with each property condition as follows: ->propertyCondition('langcode', 'en...
How to get the current page language?
Thanks so much! It's working now: I was able to transfer the docroot files to the containing directory without the need for a second database or any manual configuration export/import/sync...
Backup & Migrate Config: There was a problem creating field...database table with the name already exists.