preprocess field page projet

This commit is contained in:
2023-07-11 20:00:14 +02:00
parent 0d3987c3fd
commit e9ef306ddc
6 changed files with 437 additions and 184 deletions
+34 -4
View File
@@ -41,10 +41,40 @@ function eql_preprocess_field(&$variables) {
$type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
$variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
}
// if ($field_name == 'field--name-title'){
// $name_title = $node->get('field--name-title')->getString();
// $variables['attributes']['class'][] = 'name_title-' . $name_title;
// }
if ($field_name == 'field--name-field-type-de-moa'){
$type_de_moa = $node->get('field--name-field-type-de-moa')->getString();
$variables['attributes']['class'][] = 'filtre-projet-' . $type_de_moa;
}
}
}
function eql_preprocess_layout__threecol_25_50_25(&$variables) {
$node = \Drupal::routeMatch()->getParameter('node');
$type = $node->gettype();
if($type == "projet"){
$variables['content']['top_bottom'] = [];
$variables['content']['top_right'] = [];
$variables['content']['top_left'] = [];
foreach ($variables['content']['top'] as $key => $value) {
// // tu fais ce que tu as a faire
if(isset($value['#base_plugin_id']) && $value['#base_plugin_id']== 'entity_field'){
$t = 't';
if($value['#derivative_plugin_id']=="node:field_type_de_moa" || $value['#derivative_plugin_id']=="node:field_adresse"|| $value['#derivative_plugin_id']=="node:field_type_de_projet" || $value['#derivative_plugin_id']=="node:field_etape_du_projet") {
$variables['content']['top_bottom'][] = $variables['content']['top'][$key];
unset($variables["content"]["top"][$key]);
}
if($value['#derivative_plugin_id']=="node:title" || $value['#derivative_plugin_id']=="node:field_equipe" || $value['#derivative_plugin_id']=="node:field_incube"){
$variables['content']['top_right'][] = $variables['content']['top'][$key];
unset($variables["content"]["top"][$key]);
}
if($value['#derivative_plugin_id']=="node:field_photo"){
$variables['content']['top_left'][] = $variables['content']['top'][$key];
unset($variables["content"]["top"][$key]);
}
}
}
}
}