You are here

function registration_register_page_access in Entity Registration 7

Same name and namespace in other branches
  1. 8.2 registration.module \registration_register_page_access()
  2. 8 registration.module \registration_register_page_access()
  3. 7.2 registration.module \registration_register_page_access()

Access callback: for registration_register_page().

Check if user has access to register for a host entity.

Parameters

string $entity_type: The host entity type.

object $entity: The host entity.

Return value

bool Whether a user can create a new registration for a host entity.

See also

registration_register_page()

registration_menu()

1 call to registration_register_page_access()
registration_field_formatter_view in includes/registration.field.inc
Implements hook_field_formatter_view().
1 string reference to 'registration_register_page_access'
registration_menu in ./registration.module
Implements hook_menu().

File

./registration.module, line 561

Code

function registration_register_page_access($entity_type, $entity) {
  list($entity_id) = entity_extract_ids($entity_type, $entity);
  if ($type = registration_get_entity_registration_type($entity_type, $entity)) {
    $registration = entity_get_controller('registration')
      ->create(array(
      'entity_type' => $entity_type,
      'entity_id' => $entity_id,
      'type' => $type,
    ));
    if (entity_access('create', 'registration', $registration)) {
      $settings = registration_entity_settings($entity_type, $entity_id);
      if ($settings['status']) {
        return TRUE;
      }
    }
  }
  return FALSE;
}