You are here

function bat_event_entity_info in Booking and Availability Management Tools for Drupal 7

Implements hook_entity_info().

File

modules/bat_event/bat_event.module, line 63
Manage Events - Events store the EventValue of a Unit over a period of time.

Code

function bat_event_entity_info() {
  $return['bat_event'] = array(
    'label' => t('Events'),
    // The entity class and controller class extend the classes provided by the
    // Entity API.
    'entity class' => 'BatEvent',
    'controller class' => 'BatEventController',
    'base table' => 'bat_events',
    'fieldable' => TRUE,
    'entity keys' => array(
      'id' => 'event_id',
      'bundle' => 'type',
    ),
    // Bundles are defined by the event types below.
    'bundles' => array(),
    // Bundle keys tell the FieldAPI how to extract information from the bundle.
    'bundle keys' => array(
      'bundle' => 'type',
    ),
    'label callback' => 'entity_class_label',
    'uri callback' => 'entity_class_uri',
    'creation callback' => 'bat_event_create',
    'access callback' => 'bat_event_access',
    'access arguments' => array(
      'user key' => 'uid',
      'access tag' => 'bat_event_access',
    ),
    'permission labels' => array(
      'singular' => t('event'),
      'plural' => t('events'),
    ),
    'module' => 'bat_event',
    'admin ui' => array(
      'path' => 'admin/bat/events',
      'file' => 'bat_event.admin.inc',
      'controller class' => 'BatEventUIController',
      'menu wildcard' => '%bat_event',
    ),
    'metadata controller class' => 'BatEventMetadataController',
  );

  // The entity that holds information about the entity types.
  $return['bat_event_type'] = array(
    'label' => t('Event Type'),
    'entity class' => 'BatEventType',
    'controller class' => 'BatEventTypeController',
    'base table' => 'bat_event_type',
    'fieldable' => FALSE,
    'bundle of' => 'bat_event',
    'exportable' => TRUE,
    'entity keys' => array(
      'id' => 'id',
      'name' => 'type',
      'label' => 'label',
    ),
    'access callback' => 'bat_event_type_access',
    'module' => 'bat_event',
    // Enable the entity API's admin UI.
    'admin ui' => array(
      'path' => 'admin/bat/events/event-types',
      'file' => 'bat_event_type.admin.inc',
      'controller class' => 'BatEventTypeUIController',
    ),
  );
  return $return;
}