You are here

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

Retrieves parameters defined by plugins and return them as an array.

Parameters

$form_state:

Return value

array

2 calls to rooms_booking_manager_get_plugin_parameters()
rooms_booking_availability_search_form_submit in modules/rooms_booking_manager/rooms_booking_manager.availability_search.inc
Submit callback for rooms_booking_availability_search_form form.
rooms_booking_manager_change_search_form_submit in modules/rooms_booking_manager/rooms_booking_manager.module
This function redirects the user back to the search box and sets up the values of the search as a convenient way to modify the search.

File

modules/rooms_booking_manager/rooms_booking_manager.module, line 2131
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_get_plugin_parameters($form_state) {
  $plugins_values = array();
  $query = array();
  ctools_include('plugins');
  $filters = ctools_get_plugins('rooms_booking', 'availabilityagent_filter');
  foreach ($filters as $filter) {
    $class = ctools_plugin_get_class($filter, 'handler');
    $plugins_values += $class::availabilitySearchParameters();
  }

  // Collect the values for booking parameters.
  foreach ($plugins_values as $value) {
    if (isset($form_state['values'][$value])) {
      $query[$value] = is_array($form_state['values'][$value]) ? implode(',', $form_state['values'][$value]) : $form_state['values'][$value];
    }
  }
  return $query;
}