id and color / type protagoniste
This commit is contained in:
@@ -15,7 +15,6 @@ function eql_preprocess_html(&$variables) {
|
||||
$variables['attributes']['class'][] = 'node-type-' . $node->bundle();
|
||||
$variables['attributes']['class'][] = 'node-id-' . $node->id();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +32,47 @@ function eql_preprocess_node(&$variables){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_field().
|
||||
*/
|
||||
function eql_preprocess_field(&$variables) {
|
||||
$node = \Drupal::routeMatch()->getParameter('node');
|
||||
if($node) {
|
||||
$type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
|
||||
$variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// function eql_preprocess_field(&$variables){
|
||||
// $node = &$variables['node'];
|
||||
// $variables['attributes']['class'][] = 'node-type-' . $node->gettype();
|
||||
// if($node->gettype() == "offre_de_service") {
|
||||
// $type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
|
||||
// $variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
|
||||
// }
|
||||
// }
|
||||
|
||||
// function MYTHEME_preprocess_field__MYFIELD(&$variables) {
|
||||
|
||||
// if ($variables['element']['#entity_type'] === 'node') {
|
||||
// $node = $variables['element']['#object'];
|
||||
// $nid = $node->id();
|
||||
// $variables['myurl'] = \Drupal::service('path.alias_manager')->getAliasByPath('/node/' . $nid);
|
||||
// }
|
||||
// }
|
||||
|
||||
// function template_preprocess_block(&$variables) {
|
||||
// $node = &$variables['node'];
|
||||
// $variables['attributes']['class'][] = 'node-type-' . $node->gettype();
|
||||
// if($node->gettype() == "offre_de_service") {
|
||||
// $type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
|
||||
// $variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user