You are here

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

AJAX callback on booking search results page when Children selector change.

2 string references to 'rooms_booking_manager_children_change_callback'
book_unit_form_builder in modules/rooms_booking_manager/rooms_booking_manager.module
The form builder builds the form (where visible is simply the purchase button) for individual bookable units.
_rooms_booking_manager_handle_per_person_pricing in modules/rooms_booking_manager/rooms_booking_manager.units_per_type_form.inc
Handles display for per person pricing.

File

modules/rooms_booking_manager/rooms_booking_manager.module, line 1898
Rooms Booking Manager brings together all the pieces required to find a room and book it - including the DrupalCommerce integration

Code

function rooms_booking_manager_children_change_callback(&$form, $form_state) {
  list($type, $price, $tmp, $fieldset, $tmp, $index) = preg_split('/[\\[(.)\\]]/', $form_state['triggering_element']['#name']);
  $commands = array();

  // Show availability of individual units.
  if ($price == '') {
    $commands[] = ajax_command_replace('#unit_' . $form['unit_id']['#value'] . '_childrensage', render($form['childrens_age']));
    $commands[] = ajax_command_replace('#unit_' . $form['unit_id']['#value'] . '_price', render($form['new_price']));
  }
  else {
    $commands[] = ajax_command_replace('#' . $type . '_' . $price . '_' . $index . '_childrensage', render($form[$type][$price][$fieldset][$index]['childrens_age']));
    $commands[] = ajax_command_replace('#' . $type . '_' . $price . '_' . $index . '_price', render($form[$type][$price][$fieldset][$index]['price']));
  }
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}