function template_preprocess_date_display_range in Date 7.3
Same name and namespace in other branches
- 8 date.theme \template_preprocess_date_display_range()
- 7.2 date.theme \template_preprocess_date_display_range()
Template preprocess function for displaying a range of dates.
File
- ./
date.theme, line 318 - Theme functions.
Code
function template_preprocess_date_display_range(&$variables) {
// Merge in the shared attributes for themes to use.
$variables['attributes_start'] += $variables['attributes'];
$variables['attributes_end'] += $variables['attributes'];
if ($variables['add_rdf']) {
// Pass along the rdf mapping for this field, if any. Add some default RDF
// attributes that will be used if not overridden by attributes passed in.
$dates = $variables['dates'];
$base_attributes = array(
'property' => array(
'dc:date',
),
'datatype' => 'xsd:dateTime',
'content' => $dates['value']['formatted_iso'],
);
$variables['attributes_start'] += $base_attributes;
$variables['attributes_end'] += $base_attributes;
$variables['attributes_end']['content'] = $dates['value2']['formatted_iso'];
foreach ($variables['attributes_end']['property'] as $delta => $property) {
$variables['attributes_end']['property'][$delta] = str_replace('start', 'end', $property);
}
}
// Pass along microdata attributes, or set display to FALSE if none are set.
if ($variables['add_microdata']) {
if (!empty($variables['microdata']['value']['#attributes'])) {
$variables['microdata']['value']['#attributes']['content'] = $variables['dates']['value']['formatted_iso'];
$variables['microdata']['value2']['#attributes']['content'] = $variables['dates']['value2']['formatted_iso'];
}
else {
$variables['add_microdata'] = FALSE;
}
}
}