class type-media sur body et position block third

This commit is contained in:
2025-05-28 00:47:58 +02:00
parent 6d28a754ae
commit 41ce75a630
3 changed files with 176 additions and 168 deletions
+7 -3
View File
@@ -5785,9 +5785,13 @@ content .page-node-type-ressource .type-les-projets-en-images.layout__region--to
.page-node-type-ressource .type-les-projets-en-images.layout__region--top .block-region-top .block-entity-fieldnodefield-images .field__items {
display: none;
}
.page-node-type-ressource.block-region-third .block-entity-fieldnodefield-liens,
.page-node-type-ressource.block-region-third .block-entity-fieldnodefield-projets-liee,
.page-node-type-ressource.block-region-third .block-entity-fieldnodefield-fichiers {
body.type-media-reportage-photos .block-region-third .block-entity-fieldnodefield-liens,
body.type-media-reportage-photos .block-region-third .block-entity-fieldnodefield-projets-liee,
body.type-media-reportage-photos .block-region-third .block-entity-fieldnodefield-fichiers,
body.type-media-vidéos .block-region-third .block-entity-fieldnodefield-liens,
body.type-media-vidéos .block-region-third .block-entity-fieldnodefield-projets-liee,
body.type-media-vidéos .block-region-third .block-entity-fieldnodefield-fichiers {
transform: translateY(-45.5rem);
}
+15 -9
View File
@@ -11,26 +11,32 @@ use Drupal\Component\Utility\Html;
use Drupal\Component\Transliteration\TransliterationInterface;
use Drupal\taxonomy\Entity\Term;
use Drupal\Core\Template\Attribute;
use Drupal\node\NodeInterface;
function eql_preprocess_html(&$variables) {
$node = \Drupal::routeMatch()->getParameter('node');
if ($node){
$variables['attributes']['class'][] = 'node-type-' . $node->bundle();
$variables['attributes']['class'][] = 'node-id-' . $node->id();
}
if ($node instanceof NodeInterface) {
if ($node instanceof \Drupal\node\NodeInterface) {
$variables['attributes']['class'][] = 'node-type-' . $node->bundle();
$variables['attributes']['class'][] = 'node-id-' . $node->id();
// Pour les ressources : ajoute la classe de type de ressource
if ($node->bundle() === 'ressource' && $node->hasField('field_type_de_ressource')) {
foreach ($node->get('field_type_de_ressource')->referencedEntities() as $term) {
// Liste des champs à traiter pour générer des classes dynamiques
$fields_to_classify = [
'field_type_de_ressource' => 'type-',
'field_type_de_media' => 'type-media-',
];
foreach ($fields_to_classify as $field_name => $prefix) {
if ($node->hasField($field_name) && !$node->get($field_name)->isEmpty()) {
foreach ($node->get($field_name)->referencedEntities() as $term) {
$label = $term->label();
$css_class = 'type-' . Html::getClass($label);
$css_class = $prefix . Html::cleanCssIdentifier(strtolower($label));
$variables['attributes']['class'][] = $css_class;
}
}
}
}
}
@@ -1,6 +1,5 @@
.carousel{display: none;}
.page-node-type-ressource{
.type-les-projets-en-images.layout__region--top{
.block-region-top{
display: flex !important;
@@ -16,7 +15,6 @@
margin-top: 5rem;
padding: 0;
order: 7;
.carousel {
display: block;
max-width: 60vw;
@@ -138,7 +136,6 @@
}
}
}
// Masquer les images Drupal originales (facultatif)
.field__items {
display: none;
@@ -146,16 +143,17 @@
}
}
}
&.block-region-third{
}
body.type-media-reportage-photos,
body.type-media-vidéos{
.block-region-third{
.block-entity-fieldnodefield-liens,
.block-entity-fieldnodefield-projets-liee,
.block-entity-fieldnodefield-fichiers{
transform: translateY(-45.5rem);
}
}
}
}