function rooms_unit_entity_info_alter in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Implements hook_entity_info_alter().
We are adding the info about the unit types via a hook to avoid a recursion issue as loading the room types requires the entity info as well.
@todo This needs to be improved
File
- modules/
rooms_unit/ rooms_unit.module, line 138 - Manage units - Units are things that can be booked on a nightly basis (e.g. rooms - but also villas bungalows, etc).
Code
function rooms_unit_entity_info_alter(&$entity_info) {
foreach (rooms_unit_get_types() as $type => $info) {
$entity_info['rooms_unit']['bundles'][$type] = array(
'label' => $info->label,
'admin' => array(
'path' => 'admin/rooms/units/unit-types/manage/%rooms_unit_type',
'real path' => 'admin/rooms/units/unit-types/manage/' . $type,
'bundle argument' => 5,
'access arguments' => array(
'bypass rooms_unit entities access',
),
),
);
}
// Create custom build mode.
$entity_info['node']['view modes']['rooms_list'] = array(
'label' => t('Rooms Results View'),
'custom settings' => FALSE,
);
}