You are here

function registration_get_properties in Entity Registration 8

Same name and namespace in other branches
  1. 7 registration.module \registration_get_properties()

Required by RegistrationMetadataController for Views integration.

Parameters

$entity:

array $options:

$name:

$type:

Return value

EntityMetadataWrapper

1 string reference to 'registration_get_properties'
RegistrationMetadataController::entityPropertyInfo in src/RegistrationMetadataController.php

File

./registration.module, line 1738

Code

function registration_get_properties($entity, array $options, $name, $type) {
  switch ($name) {
    case 'anon_mail':
      return $entity->anon_mail;
      break;
    case 'entity':
      return entity_metadata_wrapper($entity->entity_type, $entity->entity);
      break;
    case 'mail':

      // If a user is set, use their email
      $user = entity_metadata_wrapper('registration', $entity)->user;
      return $user
        ->value() ? $user->mail
        ->value() : $entity->anon_mail;
      break;
  }
}