You are here

function bat_unit_entity_info_alter in Booking and Availability Management Tools for Drupal 7

Implements hook_entity_info_alter().

We are adding the info about the unit bundles via a hook to avoid a recursion issue as loading the unit bundles requires the entity info as well.

File

modules/bat_unit/bat_unit.module, line 247

Code

function bat_unit_entity_info_alter(&$entity_info) {

  // Work on Bat Units.
  foreach (bat_unit_get_bundles() as $bundle => $info) {
    $entity_info['bat_unit']['bundles'][$bundle] = array(
      'label' => $info->label,
      'admin' => array(
        'path' => 'admin/bat/config/unit-bundles/manage/%bat_unit_bundle',
        'real path' => 'admin/bat/config/unit-bundles/manage/' . $bundle,
        'bundle argument' => 5,
        'access arguments' => array(
          'bypass bat_unit entities access',
        ),
      ),
    );
  }

  // Work on Bat Types.
  foreach (bat_unit_get_type_bundles() as $bundle => $info) {
    $entity_info['bat_type']['bundles'][$bundle] = array(
      'label' => $info->label,
      'admin' => array(
        'path' => 'admin/bat/config/type-bundles/manage/%bat_type_bundle',
        'real path' => 'admin/bat/config/type-bundles/manage/' . $bundle,
        'bundle argument' => 5,
        'access arguments' => array(
          'bypass bat_type entities access',
        ),
      ),
    );
  }

  // Create custom build mode.
  $entity_info['node']['view modes']['bat_list'] = array(
    'label' => t('Bat Results View'),
    'custom settings' => FALSE,
  );
}