You are here

function template_preprocess_views_view_fullcalendar in FullCalendar 6

Same name and namespace in other branches
  1. 7 fullcalendar.module \template_preprocess_views_view_fullcalendar()

Passes options to the FullCalendar plugin as JavaScript settings.

File

./fullcalendar.module, line 181
Provides a views style plugin for FullCalendar

Code

function template_preprocess_views_view_fullcalendar(&$vars) {
  $settings = array(
    'defaultView' => $vars['options']['display']['fc_view'],
    'firstDay' => $vars['options']['display']['fc_firstday'],
    'weekMode' => $vars['options']['display']['fc_weekmode'],
    'theme' => $vars['options']['modules']['fc_theme'],
    'colorbox' => $vars['options']['modules']['fc_url_colorbox'],
    'left' => $vars['options']['header']['fc_left'],
    'center' => $vars['options']['header']['fc_center'],
    'right' => $vars['options']['header']['fc_right'],
    'year' => $vars['options']['defaults']['fc_year'],
    'month' => $vars['options']['defaults']['fc_month'],
    'day' => $vars['options']['defaults']['fc_day'],
    'agenda' => $vars['options']['times']['fc_timeformat'],
    'clock' => $vars['options']['times']['fc_clock'],
    'monthNames' => array_values(date_month_names(TRUE)),
    'monthNamesShort' => array_values(date_month_names_abbr(TRUE)),
    'dayNames' => date_week_days(TRUE),
    'dayNamesShort' => date_week_days_abbr(TRUE),
    'allDayText' => t('All day'),
    'dayString' => t('Day'),
    'weekString' => t('Week'),
    'monthString' => t('Month'),
    'todayString' => t('Today'),
  );
  drupal_add_js(array(
    'fullcalendar' => $settings,
  ), 'setting');
  drupal_add_js(drupal_get_path('module', 'fullcalendar') . '/fullcalendar.views.js', 'module');
}