You are here

function template_preprocess_date_display_range in Date 8

Same name and namespace in other branches
  1. 7.3 date.theme \template_preprocess_date_display_range()
  2. 7.2 date.theme \template_preprocess_date_display_range()

Template preprocess function for displaying a range of dates.

File

./date.theme, line 244
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.
    $rdf_mapping = $variables['rdf_mapping'];
    $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);
    }
  }
}