function rooms_booking_manager_options_change_callback in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
Ajax callback on booking search results page when an Options state change.
3 string references to 'rooms_booking_manager_options_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_add_options in modules/
rooms_booking_manager/ rooms_booking_manager.units_per_type_form.inc - Checks if there are any options to add to units and loads them if so.
- _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 1874 - 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_options_change_callback(&$form, $form_state) {
list($type, $price, $tmp, $fieldset, $tmp, $index, $tmp, $option) = preg_split('/[\\[(.)\\]]/', $form_state['triggering_element']['#name']);
$commands = array();
// Show availability of individual units.
if ($fieldset == '') {
$option = $price;
$commands[] = ajax_command_replace('#unit_' . $form['unit_id']['#value'] . '_' . $option . '_quantity', render($form['options'][$option . ':quantity']));
$commands[] = ajax_command_replace('#unit_' . $form['unit_id']['#value'] . '_price', render($form['new_price']));
}
else {
$commands[] = ajax_command_replace('#' . $type . '_' . $price . '_' . $index . '_' . $option . '_quantity', render($form[$type][$price]['fieldset'][$index][$option . ':quantity']));
$commands[] = ajax_command_replace('#' . $type . '_' . $price . '_' . $index . '_price', render($form[$type][$price][$fieldset][$index]['price']));
}
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}