function invite_by_email_load_from_session in Invite 8
Loads Invite using information stored in session.
Return value
bool|Invite Return the Invite of FALSE otherwise.
1 call to invite_by_email_load_from_session()
- invite_by_email_form_user_register_form_alter in modules/
invite_by_email/ invite_by_email.module - Implements hook_form_FORMID_alter().
File
- modules/
invite_by_email/ invite_by_email.module, line 125 - Contains invite_by_email.module.
Code
function invite_by_email_load_from_session() {
if (isset($_SESSION[InviteConstants::INVITE_SESSION_CODE])) {
/** @var \Drupal\invite\InviteInterface $invite */
$invite = \Drupal::entityTypeManager()
->getStorage('invite')
->loadByProperties([
'reg_code' => $_SESSION[InviteConstants::INVITE_SESSION_CODE],
]);
}
if (!empty($invite)) {
return $invite;
}
else {
return [];
}
}