meetup user profil nom prenom

This commit is contained in:
Bachir Soussi Chiadmi 2024-04-19 17:43:06 +02:00
parent fea4a05aab
commit 97b7d0396f
2 changed files with 14 additions and 1 deletions

View File

@ -25,6 +25,19 @@ function erabletheme_preprocess_page(&$variables) {
function erabletheme_preprocess_node(&$variables) { function erabletheme_preprocess_node(&$variables) {
$t = "t"; $t = "t";
} }
function erabletheme_preprocess_node__view__meetup(&$variables) {
/** @var \Drupal\node\Entity */
$node = $variables['node'];
$user_id = $node->get('uid')->getValue()[0]['target_id'];
/** @var Drupal\user\Entity */
$user = \Drupal\user\Entity\User::load($user_id);
/** @var Drupal\profile\Entity */
$profile = $user->get('candidat' . '_profiles')->entity;
$variables['profile'] = [
'nom' => $profile->get('field_nom')->getValue()[0]['value'],
'prenom' => $profile->get('field_prenom')->getValue()[0]['value']
];
}
/** /**
* Implements hook_preprocess_HOOK() for node.html.twig. * Implements hook_preprocess_HOOK() for node.html.twig.

View File

@ -74,6 +74,6 @@
<a href="{{ url }}"><p>Proposé le {{ date }}</p></a> <a href="{{ url }}"><p>Proposé le {{ date }}</p></a>
<p>→</p> <p>→</p>
</div> </div>
<a href="{{ url }}" class="author">{{ author_name }}</a> <a href="{{ url }}" class="author">{{ profile.prenom }} {{ profile.nom }}</a>
<a href="{{ url }}" class="offre-title"><h2{{ title_attributes }}>{{ label }}</h2></a> <a href="{{ url }}" class="offre-title"><h2{{ title_attributes }}>{{ label }}</h2></a>
</article> </article>