function rooms_booking_entity_info in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Implements hook_entity_info().
File
- modules/
rooms_booking/ rooms_booking.module, line 334 - Manage Bookings - Bookings are tied to a customer profile and possible a Unit ID and Order ID.
Code
function rooms_booking_entity_info() {
$return['rooms_booking'] = array(
'label' => t('Bookings'),
// The entity class and controller class extend the classes provided by the
// Entity API.
'entity class' => 'RoomsBooking',
'controller class' => 'RoomsBookingController',
'base table' => 'rooms_bookings',
'fieldable' => TRUE,
'entity keys' => array(
'id' => 'booking_id',
'bundle' => 'type',
),
// Bundles are defined by the booking 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' => 'rooms_booking_create',
'access callback' => 'rooms_booking_access',
'access arguments' => array(
'user key' => 'uid',
'access tag' => 'rooms_booking_access',
),
'permission labels' => array(
'singular' => t('booking'),
'plural' => t('bookings'),
),
'module' => 'rooms_booking',
'admin ui' => array(
'path' => 'admin/rooms/bookings',
'file' => 'rooms_booking.admin.inc',
'controller class' => 'RoomsBookingUIController',
'menu wildcard' => '%rooms_booking',
),
);
// The entity that holds information about the entity types.
$return['rooms_booking_type'] = array(
'label' => t('Booking Type'),
'entity class' => 'RoomsBookingType',
'controller class' => 'RoomsBookingTypeController',
'base table' => 'rooms_booking_type',
'fieldable' => FALSE,
'bundle of' => 'rooms_booking',
'exportable' => TRUE,
'entity keys' => array(
'id' => 'id',
'name' => 'type',
'label' => 'label',
),
'access callback' => 'rooms_booking_type_access',
'module' => 'rooms_booking',
// Enable the entity API's admin UI.
'admin ui' => array(
'path' => 'admin/rooms/bookings/booking-types',
'file' => 'rooms_booking_type.admin.inc',
'controller class' => 'RoomsBookingTypeUIController',
),
);
return $return;
}