Parcourir la source

user name in header

bach il y a 9 mois
Parent
commit
fa660c0046

+ 11 - 1
web/themes/custom/reha/reha.theme

@@ -5,7 +5,7 @@ use Drupal\Core\Url;
 use Drupal\Core\Link;
 use Drupal\Core\Render\Markup;
 use Drupal\Component\Utility\Html;
-
+use Drupal\user\Entity\User;
 
 /**
  * @file
@@ -102,5 +102,15 @@ function reha_preprocess_block(&$variables) {
       }
     }
   }
+
+
+  if ($variables['plugin_id'] === "views_block:current_user_block-block_1") {
+    $user = User::load($variables['user']->id());
+    $prenomnom = $user->get('field_prenom')->getString() . ' ' . $user->get('field_nom')->getString();
+    $variables['content']['#title']['#markup'] = $prenomnom;
+    $variables['label']['#markup'] = $prenomnom;
+  }
+
+
 }
 

+ 1 - 1
web/themes/custom/reha/templates/block--views-block--current-user-block-block-1.html.twig

@@ -47,7 +47,7 @@
   <div class="connected">
     <div class="connected-full">
       <section class="titre">
-        <p> Informations personnelles </p>
+        <p>Informations personnelles</p>
       </section> 
 
       {{ content }}