You are here

function theme_date_display_combination in Date 5

Same name and namespace in other branches
  1. 8 date.theme \theme_date_display_combination()
  2. 5.2 date/date.theme \theme_date_display_combination()
  3. 6.2 date/date.theme \theme_date_display_combination()
  4. 6 date/date.theme \theme_date_display_combination()
  5. 7.3 date.theme \theme_date_display_combination()
  6. 7 date.theme \theme_date_display_combination()
  7. 7.2 date.theme \theme_date_display_combination()

Theme from/to date combination in the view.

Parameters

$field = the field settings: @param $node = node information, this is not always available and not always the full node, it depends on what value was provided to the formatter. Only the nid is always guaranteed to be available. @param $dates - an array of date information, see explanation for date_field_object() for details.

Useful values: $field['type_name'] is the content type $field['type'] is the field type $node->nid is the node nid, get other node values using node_load($node->nid) $dates['value']['object']->local->timestamp - the local timestamp for the From date $dates['value2']['object']->local->timestamp - the local timestamp for the To date $dates['value']['object']->db->timestamp - the timestamp of the From date database (GMT) value $dates['value2']['object']->db->timestamp - the timestamp of the To date database (GMT) alue $dates['formatter'] = formatter name, i.e. 'default'; $dates['value']['formatted'] = formatted From date, i.e. 'February 15, 2007 2:00 pm'; $dates['value2']['formatted'] = formatted To date, i.e. 'February 15, 2007 6:00 pm';

1 theme call to theme_date_display_combination()
theme_date_formatter in ./date.module
Theme date formatter.

File

./date.module, line 810
Defines a date/time field type.

Code

function theme_date_display_combination($field, $dates, $node = NULL) {
  $date1 = $dates['value']['formatted'];
  $date2 = $dates['value2']['formatted'];
  if (empty($date1) && empty($date2)) {
    return '';
  }
  elseif ($date1 == $date2 || empty($date2)) {
    return '<span class="date-display-single">' . $date1 . '</span>';
  }
  else {
    return '<span class="date-display-start">' . $date1 . '</span><span class="date-display-separator"> - </span><span class="date-display-end">' . $date2 . '</span>';
  }
}