function rooms_booking_edit_form_get_room_types in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Returns a list of room types user can edit.
1 call to rooms_booking_edit_form_get_room_types()
- rooms_booking_edit_form in modules/
rooms_booking/ rooms_booking.admin.inc - Form callback: create or edit a booking.
File
- modules/
rooms_booking/ rooms_booking.admin.inc, line 1029 - Rooms editing UI.
Code
function rooms_booking_edit_form_get_room_types() {
$efq = new EntityFieldQuery();
$efq
->entityCondition('entity_type', 'rooms_unit');
$efq
->addTag('rooms_availability_access');
$result = $efq
->execute();
$entities = entity_load('rooms_unit', array_keys($result['rooms_unit']));
$types = array();
$all_types = rooms_unit_get_types();
foreach ($entities as $entity) {
if (!isset($types[$entity->type])) {
$current_type = $all_types[$entity->type];
$types[$entity->type] = $current_type->label;
}
}
return $types;
}