You are here

function availability_calendar_add_viewport_js in Availability Calendars 7.4

Same name and namespace in other branches
  1. 7.5 availability_calendar.theme.inc \availability_calendar_add_viewport_js()
  2. 7.3 availability_calendar.theme.inc \availability_calendar_add_viewport_js()

Adds the necessary javascript to be able to show an (interactive) calendar in a viewport.

Parameters

array $variables: Array with arguments passed to the theme.

Return value

string The element id to use for this view.

1 call to availability_calendar_add_viewport_js()
theme_availability_calendar_viewport in ./availability_calendar.theme.inc
Themes the availability calendar field in a viewport.

File

./availability_calendar.theme.inc, line 442

Code

function availability_calendar_add_viewport_js($variables) {
  $cvid = $variables['cvid'];
  availability_calendar_add_calendar_view_js($cvid, $variables['cid'], $variables['name'], $variables['settings']);
  drupal_add_js(drupal_get_path('module', 'availability_calendar') . '/availability_calendar.viewport.js');
  drupal_add_js(array(
    'availabilityCalendar' => array(
      'viewports' => array(
        $cvid => array(
          'cvid' => $cvid,
          'dimensionsCalculation' => $variables['settings']['viewport']['dimensions_calculation'],
          'cols' => (int) $variables['settings']['viewport']['cols'],
          'rows' => (int) $variables['settings']['viewport']['rows'],
          'scroll' => (int) $variables['settings']['viewport']['scroll'],
        ),
      ),
    ),
  ), array(
    'type' => 'setting',
  ));
}