function theme_bat_fullcalendar in Booking and Availability Management Tools for Drupal 7
Theme function for FullCalendar.
2 theme calls to theme_bat_fullcalendar()
- bat_calendar_reference_field_formatter_view in modules/
bat_calendar_reference/ bat_calendar_reference.module - Implements hook_field_formatter_view().
- bat_event_ui_calendar_page in modules/
bat_event_ui/ bat_event_ui.module - Callback for admin/bat/calendar.
File
- modules/
bat_fullcalendar/ bat_fullcalendar.module, line 691 - Manages the display of FullCalendar and provides ways for other modules to easily modify it.
Code
function theme_bat_fullcalendar($vars) {
$calendar_id = $vars['calendar_settings']['calendar_id'];
$modal_style = $vars['calendar_settings']['modal_style'];
$user_settings = $vars['calendar_settings']['user_settings'];
// Check if user has defined js files and swap those in.
if (!empty($vars['js_files'])) {
$js_files = bat_fullcalendar_set_js_files($vars['js_files']);
}
else {
$js_files = bat_fullcalendar_set_js_files();
}
// Check for CSS files.
if (!empty($vars['css_files'])) {
$css_files = bat_fullcalendar_set_css_files($vars['css_files']);
}
else {
$css_files = bat_fullcalendar_set_css_files();
}
// Attributes.
if (!empty($vars['attributes'])) {
$attributes = $vars['attributes'];
}
else {
$attributes = array(
'id' => drupal_html_id('calendar'),
'class' => array(
'calendar-set',
'clearfix',
),
);
if (isset($vars['calendar_settings']['class']) && !empty($vars['calendar_settings']['class'])) {
$attributes['class'] = array_merge($attributes['class'], $vars['calendar_settings']['class']);
}
}
// Override default settings with ones coming form user.
$settings = bat_fullcalendar_configure($vars['calendar_settings']['user_settings']);
// Add FullCalendar JS.
bat_fullcalendar_library_loaded($calendar_id);
bat_fullcalendar_modal_style($modal_style);
foreach ($js_files as $js_file) {
drupal_add_js($js_file, array(
'type' => 'file',
'scope' => 'footer',
));
}
foreach ($css_files as $css_file) {
drupal_add_css($css_file, array(
'type' => 'file',
));
}
$settings['batCalendar'][0]['id'] = $attributes['id'];
drupal_add_js($settings, 'setting');
$render_array = array(
'#markup' => '<div' . drupal_attributes($attributes) . '></div>',
);
return render($render_array);
}