| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 | 
							- <?php
 
- /*
 
- 	* @files
 
- 	* Theme Template Funtions
 
- */
 
- // use Drupal\Core\Template\Attribute;
 
- // use Drupal\Core\Link;
 
- // use Drupal\Core\Url;
 
- 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();
 
-   }
 
- }
 
- function eql_preprocess_node(&$variables){
 
-   $node = &$variables['node'];
 
-   $variables['attributes']['class'][] = 'node-type-' . $node->gettype();
 
-   // $variables['elements']['content_bottom'] = [];   /////////////////////////////
 
-   if($node->gettype() == "actualite") {
 
-     $actu_type = $node->get('field_actu_type')->getString();
 
-     $variables['attributes']['class'][] = 'actu-type-' . $actu_type;
 
-   }
 
-   if($node->gettype() == "offre_de_service") {
 
-     $type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
 
-     $variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
 
-   }
 
-   // foreach ($variables['elements'] as $key => $value){              //////////////////////////////////
 
-     // if(isset($value['#view_mode']) && $value['#view_mode']== 'teaser'){
 
-       // if($value['elements']=="field_region" || $value['#derivative_plugin_id']=="node:field_adresse"){
 
-         // $variables['elements']['content_bottom'][] = $variables["elements"]["field_incube"]["#field_name"];
 
-       // }
 
-    
 
-     // }
 
-   // }
 
-   
 
-   
 
- }
 
- function eql_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;
 
-     }
 
-   }
 
- }
 
- ////////////
 
- function eql_preprocess_layout__threecol_25_50_25(&$variables) {
 
-   $node = \Drupal::routeMatch()->getParameter('node');
 
-   // $node = &$variables['node'];
 
-   // $variables['attributes']['class'][] = 'node-type-' . $node->gettype();
 
-   if($node->gettype() == "projet"){
 
-     $variables['content']['top_bottom'] = [];     /////// déclare les nvx array 
 
-     $variables['content']['top_right'] = [];
 
-     $variables['content']['top_left'] = [];
 
-     $variables['content']['top_bottom_left'] = [];
 
-     foreach ($variables['content']['top'] as $key => $value) {
 
-       if(isset($value['#base_plugin_id']) && $value['#base_plugin_id']== 'entity_field'){      ////// isset pour voir si existe && si oui fait ce que tu as à faire. $Value c'est l'attribut  
 
-         if($value['#derivative_plugin_id']=="node:field_region" || $value['#derivative_plugin_id']=="node:field_adresse") {
 
-           $variables['content']['top_bottom_left'][] = $variables['content']['top'][$key];
 
-           unset($variables["content"]["top"][$key]); 
 
-         }
 
-         if($value['#derivative_plugin_id']=="node:field_type_de_moa" || $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]); 
 
-         }
 
-         // foreach ($variables['content']['top_bottom'] as $key => $value) {
 
-         // }  
 
-         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]);
 
-         }
 
-       }
 
-     }
 
-   }
 
- }
 
- // function eql_preprocess_views_row_plugins(&$variables){
 
- //   $t = 't';
 
- // }
 
- //////////////////////////////////////////////////
 
- // function eql_preprocess_input(&$variables) {
 
- //   $form = \Drupal::routeMatch()->getParameter('form');
 
-   
 
- //   $form['keys']['#attributes']['placeholder'] = t('The new placeholder');
 
- // }
 
- // 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;
 
- //   }
 
- // }
 
- ///////////////////////////////////////////////////
 
- ///////////////////////////////////////////////////
 
- // counter pour id
 
-             // function eql_preprocess_field(&$variables) {
 
-             //   // static $counter = 0;
 
-             //   // $variables['counter'] = $counter++;
 
-             //   $variables['elements']['#paragraph']->item_id;
 
-             // }
 
- // la fonction suivante ne fonctionne pas
 
- // function eql_preprocess_field(&$variables) {
 
- //   $paragraph = &$variables['paragraph'];
 
- //   $variables['attributes']['class'][] = 'paragraph-type-' . $paragraph->id();
 
- //   $hook_id = $paragraph->get('paragraph-id--')->getString();
 
- //   $variables['attributes']['class'][] = 'hook-id-' . $hook_id;
 
- // }
 
-                   //might be useful for if-clause: $variables['field_name'] and $variables['field_type']
 
-                   // if ($paragraph && $paragraph->getEntityTypeId() == 'paragraph' . $paragraph->id() ) {
 
-                     //whatever logic you need goes here, e.g. something like
 
-                     //$variables['attributes']['data-from-parent-paragraph'] = $parentEntity->getYourStuff();
 
-                   // }
 
-                 // function yourtheme_preprocess_field(&$variables, $hook) {
 
-                 //   $element = $variables['element'];
 
-                 //   $parentEntity = $element['#object'];
 
-                 //   //might be useful for if-clause: $variables['field_name'] and $variables['field_type']
 
-                 //   if ($parentEntity && $parentEntity->getEntityTypeId() == 'paragraph' ) {
 
-                 //     //whatever logic you need goes here, e.g. something like
 
-                 //     //$variables['attributes']['data-from-parent-paragraph'] = $parentEntity->getYourStuff();
 
-                 //   }
 
-                 // }
 
-                 // $variables['elements']['#entity']->item_id;
 
-                 // function MYTHEME_preprocess_views_view_fields__view_machine_name(&$vars) {
 
-                 //   static $counter = 0;
 
-                 //   $vars['counter'] = $counter++;
 
-                 // }
 
 
  |