function party_activity_preprocess_fullcalendar in Party 7
Implements hook_preprocess_fullcalendar
File
- modules/
party_activity/ party_activity.module, line 550 - Functions and important hooks for the party_activity module
Code
function party_activity_preprocess_fullcalendar(&$variables) {
$controller = entity_ui_controller('party_activity');
// Add ctools modal js.
ctools_include('modal');
ctools_modal_add_js();
// Add settings.
$tz = new DateTimeZone(date_default_timezone());
$date_time = new DateTime('now', $tz);
$settings = array(
'party_activity_popup' => array(
'add_path' => $controller
->getModalAddPath(),
),
'party_activity_timezone' => array(
'timezone' => date_default_timezone(),
'offset' => $tz
->getOffset($date_time),
),
);
drupal_add_js($settings, 'setting');
drupal_add_js(drupal_get_path('module', 'party_activity') . '/js/party_activity.fullcalendar.js');
foreach ($variables['element']['content']['events'] as &$events) {
foreach ($events['#event'] as &$event) {
$event['#path'] = $controller
->getModalEditPath($event['#options']['attributes']['eid']);
$event['#options']['query']['fc'] = 1;
$event['#options']['query']['views_view'] = $variables['view']->name;
$event['#options']['query']['views_display'] = $variables['view']->current_display;
$event['#options']['attributes']['cn'] .= ' ctools-use-modal';
}
}
// Add view name and display to the full calendar div.
$variables['element']['fullcalendar']['#attributes']['views_view'] = $variables['view']->name;
$variables['element']['fullcalendar']['#attributes']['views_display'] = $variables['view']->current_display;
}