You are here

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

JSON output for autocomplete rooms_booking_types.

Parameters

string $rooms_booking_type_name: The rooms_booking type seed to look for.

1 string reference to 'rooms_booking_get_room_types'
rooms_booking_menu in modules/rooms_booking/rooms_booking.module
Implements hook_menu().

File

modules/rooms_booking/rooms_booking.module, line 968
Manage Bookings - Bookings are tied to a customer profile and possible a Unit ID and Order ID.

Code

function rooms_booking_get_room_types($rooms_booking_type_name = '') {
  $matches = array();
  if ($rooms_booking_type_name) {
    $result = db_select('rooms_booking_type')
      ->fields('rooms_booking_type', array(
      'type',
    ))
      ->condition('type', db_like($rooms_booking_type_name) . '%', 'LIKE')
      ->range(0, 10)
      ->execute();
    foreach ($result as $room_type) {
      $matches[$room_type->type] = check_plain($room_type->type);
    }
  }
  drupal_json_output($matches);
}