You are here

function availability_calendar_booking_formlet_add_js in Availability Calendars 7.4

Same name and namespace in other branches
  1. 7.5 booking_formlet/availability_calendar_booking_formlet.inc \availability_calendar_booking_formlet_add_js()
  2. 7.3 booking_formlet/availability_calendar_booking_formlet.module \availability_calendar_booking_formlet_add_js()

Adds the javascript for the booking formlet to the page.

Parameters

string $form_id:

array $cids:

array $settings:

1 call to availability_calendar_booking_formlet_add_js()
availability_calendar_booking_formlet_form in booking_formlet/availability_calendar_booking_formlet.module
Callback for drupal_get_form() to create the booking formlet view.

File

booking_formlet/availability_calendar_booking_formlet.module, line 802
Availability Calendar booking formlet module. This submdule of the Availability Calendar module defines a field that shows a small booking form that interacts with a calendar field. The form only has an arraival and departure date field and a submit…

Code

function availability_calendar_booking_formlet_add_js($form_id, $cids, $settings) {

  // Ensure that the base client side API loads as well including, optionally,
  // the date formatting functionality of date picker.
  availability_calendar_add_base_js();
  drupal_add_js(drupal_get_path('module', 'availability_calendar_booking_formlet') . '/availability_calendar_booking_formlet.js', array(
    'type' => 'file',
  ));
  drupal_add_js(array(
    'availabilityCalendar' => array(
      'bookingFormlets' => array(
        $form_id => array(
          'formId' => "#{$form_id}",
          'cids' => $cids,
          'bookedState' => $settings['booked_state'],
          'singleDay' => (bool) $settings['single_day_only'],
          'displayDuration' => $settings['display_duration'],
        ),
      ),
    ),
  ), array(
    'type' => 'setting',
  ));
}