function calendar_systems_preprocess_content_field in Calendar Systems 6
Same name and namespace in other branches
- 8 calendar_systems.module \calendar_systems_preprocess_content_field()
- 6.3 calendar_systems.module \calendar_systems_preprocess_content_field()
- 7.3 calendar_systems.module \calendar_systems_preprocess_content_field()
- 7 calendar_systems.module \calendar_systems_preprocess_content_field()
- 7.2 calendar_systems.module \calendar_systems_preprocess_content_field()
For basic integration with views
Parameters
$variables:
File
- ./
calendar_systems.module, line 412
Code
function calendar_systems_preprocess_content_field(&$variables) {
// Are we called for the right field?
if ($variables['field_type'] == 'date') {
foreach ($variables['items'] as $key => $item) {
$display = 'full';
if ($variables['teaser']) {
$display = 'teaser';
}
$type_info = date_get_format_types($variables['field']['display_settings'][$display]['format']);
if (!$type_info) {
$_format = $variables['field']['default_format'];
}
else {
$_format = $type_info['title'];
}
if (!isset($variables['field']['granularity'])) {
$granularity = FALSE;
}
else {
$granularity = $variables['field']['granularity'];
}
if (isset($variables['items'][$key]['value2'])) {
$format = _calendar_systems_get_format($_format, $granularity);
$variables['items'][$key]['view'] = format_date(strtotime($variables['items'][$key]['value']), 'custom', $format) . ' - ' . format_date(strtotime($variables['items'][$key]['value2']), 'custom', $format);
}
else {
$format = _calendar_systems_get_format($_format, $granularity);
$variables['items'][$key]['view'] = format_date(strtotime($variables['items'][$key]['value']), 'custom', $format);
}
}
}
}