function bat_booking_entity_info in Booking and Availability Management Tools for Drupal 7
Implements hook_entity_info().
File
- modules/
bat_booking/ bat_booking.module, line 10
Code
function bat_booking_entity_info() {
$return['bat_booking'] = array(
'label' => t('BAT Booking'),
// The entity class and controller class extend the classes provided by the
// Entity API.
'entity class' => 'BatBooking',
'controller class' => 'BatBookingController',
'base table' => 'bat_bookings',
'fieldable' => TRUE,
'entity keys' => array(
'id' => 'booking_id',
'bundle' => 'type',
'label' => 'label',
),
// Bundles are defined by the booking bundles below.
'bundles' => array(),
// Bundle keys tell the FieldAPI how to extract information from the bundle
// objects.
'bundle keys' => array(
'bundle' => 'type',
),
'label callback' => 'entity_class_label',
'uri callback' => 'entity_class_uri',
'creation callback' => 'bat_booking_create',
'access callback' => 'bat_booking_access',
'access arguments' => array(
'user key' => 'uid',
'access tag' => 'bat_booking_access',
),
'permission labels' => array(
'singular' => t('booking'),
'plural' => t('bookings'),
),
'module' => 'bat_booking',
// The information below is used by the BatBookingUIController (which extends
// the EntityDefaultUIController).
'admin ui' => array(
'path' => 'admin/bat/config/booking',
'file' => 'bat_booking.admin.inc',
'controller class' => 'BatBookingUIController',
'menu wildcard' => '%bat_booking',
),
'metadata controller class' => 'BatBookingMetadataController',
'translation' => array(
'entity_translation' => array(
'base path' => 'admin/bat/config/booking/%bat_booking',
'default settings' => array(
'default_language' => LANGUAGE_NONE,
'hide_language_selector' => FALSE,
),
),
),
);
$return['bat_booking_type'] = array(
'label' => t('BAT Booking Type'),
'entity class' => 'BatBookingType',
'controller class' => 'BatBookingTypeController',
'base table' => 'bat_booking_types',
'fieldable' => TRUE,
'bundle of' => 'bat_booking',
'exportable' => TRUE,
'entity keys' => array(
'id' => 'id',
'name' => 'type',
'label' => 'label',
),
'access callback' => 'bat_booking_type_access',
'module' => 'bat_booking',
// Enable the entity API's admin UI.
'admin ui' => array(
'path' => 'admin/bat/config/booking-types',
'file' => 'bat_booking_type.admin.inc',
'controller class' => 'BatBookingTypeUIController',
),
);
return $return;
}