Skip to content
Snippets Groups Projects
Commit da21b120 authored by Melissa Miller's avatar Melissa Miller
Browse files

recitfy node template classes and node-based body classes

parent 768cbb02
No related branches found
No related tags found
1 merge request!3Theme in progress.
......@@ -73,11 +73,9 @@
{%
set classes = [
'node',
'node--type-' ~ node.bundle|clean_class,
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
'node--type--' ~ node.bundle|clean_class,
not node.isPublished() ? 'node--unpublished',
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
view_mode ? 'node--view-mode--' ~ view_mode|clean_class,
]
%}
......
......@@ -143,11 +143,10 @@
function wcm8_theme_preprocess_html(array &$variables) {
// Add footer color to body classes.
$variables['attributes']['class'][] = 'footer-color--' . theme_get_setting('footer_color');
// Add node id and type to body classes.
// Add node id to body classes.
if (\Drupal::routeMatch()->getRouteName() == 'entity.node.canonical') {
$node = \Drupal::routeMatch()->getParameter('node');
$variables['attributes']['class'][] = 'node-id--' . $node->id();
$variables['attributes']['class'][] = 'node-type--' . $node->bundle();
$variables['attributes']['class'][] = 'nid--' . $node->id();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment