function registration_property_registrant_mail_get in Entity Registration 8.2
Same name and namespace in other branches
- 7.2 registration.module \registration_property_registrant_mail_get()
Callback to get $registration->registrant->mail.
2 string references to 'registration_property_registrant_mail_get'
File
- ./
registration.module, line 1816
Code
function registration_property_registrant_mail_get($registration, array $options, $name, $type) {
$registrant = registration_get_registrant($registration);
$type = registration_get_types($registration->type);
$property_parts = explode(':', $type->registrant_email_property);
$property = $property_parts[0];
$field_col = isset($property_parts[1]) ? $property_parts[1] : NULL;
$mail = NULL;
if (isset($registrant->{$property})) {
$value = $registrant->{$property}
->value();
// If we have multiple values, just grab the first one:
if (is_array($value) && isset($value[0])) {
$value = $value[0];
}
if ($field_col && isset($value[$field_col])) {
$mail = $value[$field_col];
}
else {
$mail = $value;
}
}
return $mail ? $mail : $registration->anon_mail;
}