user name in header

This commit is contained in:
2024-06-25 10:27:58 +02:00
parent ed75c51849
commit fa660c0046
2 changed files with 12 additions and 2 deletions
+11 -1
View File
@@ -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;
}
}
@@ -47,7 +47,7 @@
<div class="connected">
<div class="connected-full">
<section class="titre">
<p> Informations personnelles </p>
<p>Informations personnelles</p>
</section>
{{ content }}