Add layout name in class for custom layout.
Currently almost at the beginning of our html we have, for example,
<div class="layout--boxton layout contextual-links-region">
Please, rather than just boxton-layout, could we have the machine name of a custom layout here so that it is easy to target styles for the layout?
In the meantime, it is possible to do this in template.php in a custom theme. In the example below, a layout named "Special page" with id "special_page" would get the class "layout-id--special-page".
function mytheme_preprocess_layout(&$vars) { // Add css class for custom layout name, with dashes instead of underscores. $layout_class = backdrop_clean_css_identifier($vars['layout']->name); $vars['classes'][] = 'layout-id--' . $layout_class; }
In the meantime there is also a module for the use case: https://github.com/backdrop-contrib/layout_body_class