gettype(); if($node->gettype() == "actualite") { $actu_type = $node->get('field_actu_type')->getString(); $variables['attributes']['class'][] = 'actu-type-' . $actu_type; } } ///////////////////////////////////////////////////