You are here

function registration_get_registrant in Entity Registration 7.2

Same name and namespace in other branches
  1. 8.2 registration.module \registration_get_registrant()

Get the registrant entity for a registration, or NULL if no registrant is associated.

Parameters

$registration: Registration object.

Return value

object Registrant entity object.

2 calls to registration_get_registrant()
registration_property_registrant_get in ./registration.module
Callback to get $registration->registrant.
registration_property_registrant_mail_get in ./registration.module
Callback to get $registration->registrant->mail.

File

./registration.module, line 1609

Code

function registration_get_registrant($registration) {
  $registrant = NULL;
  if (is_numeric($registration->registrant_id)) {
    $type = registration_get_types($registration->type);
    $entity = entity_load_single($type->registrant_entity_type, $registration->registrant_id);
    if ($entity) {
      $registrant = entity_metadata_wrapper($type->registrant_entity_type, $entity);
    }
  }
  return $registrant;
}