From 29908921d98199636d37bb5a9e2b8333c1eb3315 Mon Sep 17 00:00:00 2001 From: bach Date: Mon, 6 Nov 2023 14:55:49 +0100 Subject: [PATCH] added book-depth class to node --- web/themes/custom/rorschach/rorschach.theme | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/web/themes/custom/rorschach/rorschach.theme b/web/themes/custom/rorschach/rorschach.theme index d05c3dd..15f3edc 100644 --- a/web/themes/custom/rorschach/rorschach.theme +++ b/web/themes/custom/rorschach/rorschach.theme @@ -18,19 +18,15 @@ function rorschach_preprocess_html(&$variables) { } -// function rorschach_preprocess_node(&$variables){ -// $node = &$variables['node']; -// $variables['attributes']['class'][] = 'node-type-' . $node->gettype(); -// if($node->gettype() == "actualite") { -// $actu_type = $node->get('field_actu_type')->getString(); -// $variables['attributes']['class'][] = 'actu-type-' . $actu_type; -// } -// if($node->gettype() == "offre_de_service") { -// $type_protagoniste = $node->get('field_type_de_protagoniste')->getString(); -// $variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste; -// } +function rorschach_preprocess_node(&$variables){ + $node = &$variables['node']; + $variables['attributes']['class'][] = 'node-type-' . $node->gettype(); + if($node->gettype() == "book") { + $book = $node->book; + $variables['attributes']['class'][] = 'book-depth-' . $book['depth']; + } -// } +} function rorschach_preprocess_field(&$variables) { $node = \Drupal::routeMatch()->getParameter('node');