function template_preprocess_fullcalendar_legend in FullCalendar 7.2
Same name and namespace in other branches
- 8.5 modules/fullcalendar_legend/fullcalendar_legend.theme.inc \template_preprocess_fullcalendar_legend()
- 8 fullcalendar_legend/fullcalendar_legend.theme.inc \template_preprocess_fullcalendar_legend()
- 8.2 modules/fullcalendar_legend/fullcalendar_legend.theme.inc \template_preprocess_fullcalendar_legend()
- 8.3 fullcalendar_legend/fullcalendar_legend.theme.inc \template_preprocess_fullcalendar_legend()
- 8.4 modules/fullcalendar_legend/fullcalendar_legend.theme.inc \template_preprocess_fullcalendar_legend()
Build the legend as a render array.
File
- fullcalendar_legend/
theme/ theme.inc, line 11 - Theme functions for FullCalendar Legend.
Code
function template_preprocess_fullcalendar_legend(&$variables) {
$element = array(
'#attached' => array(
'css' => array(
ctools_attach_css('fullcalendar_legend.theme', 'fullcalendar_legend'),
),
),
);
foreach ($variables['types'] as $type_name => $type) {
$element[$type_name] = array(
'#type' => 'container',
'#attributes' => array(
'class' => _fullcalendar_legend_get_classes($type),
'entity_type' => $type['entity_type'],
'bundle' => $type['bundle'],
'field' => $type['field_name'],
),
);
// Sanitize the label.
$type['label'] = check_plain($type['label']);
if (isset($type['uri'])) {
$element[$type_name]['type'] = array(
'#type' => 'link',
'#href' => $type['uri']['path'],
'#options' => isset($type['uri']['options']) ? $type['uri']['options'] : array(),
'#title' => $type['label'],
);
}
else {
$element[$type_name]['type'] = array(
'#markup' => $type['label'],
);
}
}
$variables['element'] = $element;
}