You are here

function registration_entity_info_alter in Entity Registration 8.2

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

Implements hook_entity_info_alter().

File

./registration.module, line 120

Code

function registration_entity_info_alter(&$entity_info) {

  // @todo: we're testing to ensure the schema exists; needed because running gui
  // install profile was hitting this BEFORE the schema was installed.
  if (drupal_get_schema('registration')) {

    // We are adding the info about the registration types via a hook to avoid a
    // recursion issue as loading the model types requires the entity info as well.
    // Need to do a class_exists check for updates from earlier versions
    // of registration module.
    if (class_exists('RegistrationTypeController')) {
      foreach (registration_get_types() as $type => $info) {
        $entity_info['registration']['bundles'][$type] = array(
          'label' => $info->label,
          'admin' => array(
            'path' => 'admin/structure/registration/registration_types/manage/%registration_type',
            'real path' => 'admin/structure/registration/registration_types/manage/' . $type,
            'bundle argument' => 5,
            'access arguments' => array(
              'administer registration types',
            ),
          ),
        );
      }
    }
  }
}