You are here

function rooms_unit_get_types in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Gets an array of all unit types, keyed by the type name.

Parameters

string $type_name: If set, the type with the given name is returned.

bool $reset: A boolean indicating that the internal cache should be reset.

Return value

RoomsUnitType[] Depending whether $type isset, an array of unit types or a single one.

13 calls to rooms_unit_get_types()
RoomsUnitUIController::hook_menu in modules/rooms_unit/rooms_unit.admin.inc
Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu() is optimized for entity type administration.
rooms_availability_bulk_unit_management in modules/rooms_availability/rooms_availability.module
Form for the Bulk Availability Management.
rooms_availability_permission in modules/rooms_availability/rooms_availability.module
Implements hook_permission().
rooms_booking_edit_form_get_room_types in modules/rooms_booking/rooms_booking.admin.inc
Returns a list of room types user can edit.
rooms_booking_manager_change_search_form in modules/rooms_booking_manager/rooms_booking_manager.module
Provides a single integrated group of form elements storing the current availability search along with a "change search" button that will take you back to the initial booking search page.

... See full list

1 string reference to 'rooms_unit_get_types'
rooms_unit_type_form in modules/rooms_unit/rooms_unit_type.admin.inc
Generates the unit type editing form.

File

modules/rooms_unit/rooms_unit.module, line 328
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_get_types($type_name = NULL, $reset = FALSE) {

  // entity_load() will get the Entity controller for our unit entity and call
  // the load function of that object.
  $types = entity_load_multiple_by_name('rooms_unit_type', isset($type_name) ? array(
    $type_name,
  ) : FALSE);
  return isset($type_name) ? reset($types) : $types;
}