bug fix
This commit is contained in:
parent
97b7d0396f
commit
842b220b1d
|
@ -26,17 +26,25 @@ function erabletheme_preprocess_node(&$variables) {
|
|||
$t = "t";
|
||||
}
|
||||
function erabletheme_preprocess_node__view__meetup(&$variables) {
|
||||
/** @var \Drupal\node\Entity */
|
||||
/** @var \Drupal\node\Entity $node */
|
||||
$node = $variables['node'];
|
||||
$user_id = $node->get('uid')->getValue()[0]['target_id'];
|
||||
/** @var Drupal\user\Entity */
|
||||
/** @var Drupal\user\Entity $user*/
|
||||
$user = \Drupal\user\Entity\User::load($user_id);
|
||||
/** @var Drupal\profile\Entity */
|
||||
/** @var Drupal\profile\Entity $profile */
|
||||
$profile = $user->get('candidat' . '_profiles')->entity;
|
||||
if ($profile) {
|
||||
$variables['profile'] = [
|
||||
'nom' => $profile->get('field_nom')->getValue()[0]['value'],
|
||||
'prenom' => $profile->get('field_prenom')->getValue()[0]['value']
|
||||
'prenom' => $profile->get('field_prenom')->getValue()[0]['value'],
|
||||
'nom' => $profile->get('field_nom')->getValue()[0]['value']
|
||||
];
|
||||
} else {
|
||||
$variables['profile'] = [
|
||||
'prenom' => $user->getAccountName(),
|
||||
'nom' => "",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue