12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- /*
- * @files
- * Theme Template Funtions
- */
- // use Drupal\Core\Template\Attribute;
- // use Drupal\Core\Link;
- // use Drupal\Core\Url;
- function rorschach_preprocess_html(&$variables) {
- $node = \Drupal::routeMatch()->getParameter('node');
- if ($node){
- $variables['attributes']['class'][] = 'node-type-' . $node->bundle();
- $variables['attributes']['class'][] = 'node-id-' . $node->id();
- }
- }
- 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');
- // // $field_name = &$variables['field_name'];
- // // if($node) {
- // // // if ($field_name == 'field_type_de_protagoniste'){
- // // // $type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
- // // // $variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
- // // // }
- // // if ($field_name == 'block-pagetitle-2') {
- // // $depth_title = $node->id('block-pagetitle-2')->getString();
- // // $variables['attributes']['class'][] = 'menu-depth-' . $depth_title;
- // // }
- // // }
- // }
- //////////////////////////////////////////////////
- // $variables['classes_array'][] = "menu-depth-" . $depth;
- //////////////////////////////////////////////////
- // function rorschach_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;
- // }
- // }
- ///////////////////////////////////////////////////
|