public function Registration::registrant_type in Entity Registration 8
Determine registrant type relative to a given account.
@object $account A Drupal user
Return value
string|NULL Can be me, user, anon or NULL if account is empty and no anon email set.
File
- src/
Registration.php, line 228
Class
- Registration
- Defines the Registration entity.
Namespace
Drupal\registrationCode
public function registrant_type($account) {
$reg_type = NULL;
if (!empty($account)) {
if ($account->uid && $account->uid === $this->user_uid) {
$reg_type = REGISTRATION_REGISTRANT_TYPE_ME;
}
elseif ($this->user_uid) {
$reg_type = REGISTRATION_REGISTRANT_TYPE_USER;
}
}
if (!empty($this->anon_mail)) {
$reg_type = REGISTRATION_REGISTRANT_TYPE_ANON;
}
return $reg_type;
}