function theme_date_display_combination

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 date.theme theme_date_display_combination($variables)
cle7 date.theme theme_date_display_combination($variables)
elmsmedia7 date.theme theme_date_display_combination($variables)
icor7 date.theme theme_date_display_combination($variables)
meedjum_blog7 date.theme theme_date_display_combination($variables)
mooc7 date.theme theme_date_display_combination($variables)

Returns HTML for a date element formatted as a Start/End combination.

$entity->date_id If set, this will show only an individual date on a field with multiple dates. The value should be a string that contains the following values, separated with periods:

  • module name of the module adding the item
  • node nid
  • field name
  • delta value of the field to be displayed
  • other information the module's custom theme might need

Used by the calendar module and available for other uses. example: 'date.217.field_date.3.test'

$entity->date_repeat_show If true, tells the theme to show all the computed values of a repeating date. If not true or not set, only the start date and the repeat rule will be displayed.

$dates['format'] The format string used on these dates $dates['value']['local']['object'] The local date object for the Start date $dates['value2']['local']['object'] The local date object for the End date $dates['value']['local']['datetime'] The datetime value of the Start date database (GMT) value $dates['value2']['local']['datetime'] The datetime value of the End date database (GMT) value $dates['value']['formatted'] Formatted Start date, i.e. 'February 15, 2007 2:00 pm'; $dates['value']['formatted_date'] Only the date part of the formatted Start date $dates['value']['formatted_time'] Only the time part of the formatted Start date $dates['value2']['formatted'] Formatted End date, i.e. 'February 15, 2007 6:00 pm'; $dates['value2']['formatted_date'] Only the date part of the formatted End date $dates['value2']['formatted_time'] Only the time part of the formatted End date

Related topics

1 theme call to theme_date_display_combination()
date_field_formatter_view in sites/all/modules/ulmus/date/date.field.inc
Implements hook_field_formatter_view().
2 string references to the theme hook from theme_date_display_combination()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

date_field_formatter_view in sites/all/modules/ulmus/date/date.field.inc
Implements hook_field_formatter_view().
date_theme in sites/all/modules/ulmus/date/date.module
Implements hook_theme().

File

sites/all/modules/ulmus/date/date.theme, line 59
Theme functions.

Code

function theme_date_display_combination($variables) {
  static $repeating_ids = array();

  $entity_type = $variables['entity_type'];
  $entity = $variables['entity'];
  $field = $variables['field'];
  $instance = $variables['instance'];
  $langcode = $variables['langcode'];
  $item = $variables['item'];
  $delta = $variables['delta'];
  $display = $variables['display'];
  $field_name = $field['field_name'];
  $formatter = $display['type'];
  $options = $display['settings'];
  $dates = $variables['dates'];
  $attributes = $variables['attributes'];
  $rdf_mapping = $variables['rdf_mapping'];
  $add_rdf = $variables['add_rdf'];
  $microdata = $variables['microdata'];
  $add_microdata = $variables['add_microdata'];
  $precision = date_granularity_precision($field['settings']['granularity']);

  $output = '';

  // If date_id is set for this field and delta doesn't match, don't display it.
  if (!empty($entity->date_id)) {
    foreach ((array) $entity->date_id as $key => $id) {
      list($module, $nid, $field_name, $item_delta, $other) = explode('.', $id . '.');
      if ($field_name == $field['field_name'] && isset($delta) && $item_delta != $delta) {
        return $output;
      }
    }
  }

  // Check the formatter settings to see if the repeat rule should be displayed.
  // Show it only with the first multiple value date.
  list($id) = entity_extract_ids($entity_type, $entity);
  if (!in_array($id, $repeating_ids) && module_exists('date_repeat_field') && !empty($item['rrule']) && $options['show_repeat_rule'] == 'show') {
    $repeat_vars = array(
      'field' => $field,
      'item' => $item,
      'entity_type' => $entity_type,
      'entity' => $entity,
    );
    $output .= theme('date_repeat_display', $repeat_vars);
    $repeating_ids[] = $id;
  }

  // If this is a full node or a pseudo node created by grouping multiple
  // values, see exactly which values are supposed to be visible.
  if (isset($entity->$field_name)) {
    $entity = date_prepare_entity($formatter, $entity_type, $entity, $field, $instance, $langcode, $item, $display);
    // Did the current value get removed by formatter settings?
    if (empty($entity->{$field_name}[$langcode][$delta])) {
      return $output;
    }
    // Adjust the $element values to match the changes.
    $element['#entity'] = $entity;
  }

  switch ($options['fromto']) {
    case 'value':
      $date1 = $dates['value']['formatted'];
      $date2 = $date1;
      break;
    case 'value2':
      $date2 = $dates['value2']['formatted'];
      $date1 = $date2;
      break;
    default:
      $date1 = $dates['value']['formatted'];
      $date2 = $dates['value2']['formatted'];
      break;
  }

  // Pull the timezone, if any, out of the formatted result and tack it back on
  // at the end, if it is in the current formatted date.
  $timezone = $dates['value']['formatted_timezone'];
  if ($timezone) {
    $timezone = ' ' . $timezone;
  }
  $date1 = str_replace($timezone, '', $date1);
  $date2 = str_replace($timezone, '', $date2);
  $time1 = preg_replace('`^([\(\[])`', '', $dates['value']['formatted_time']);
  $time1 = preg_replace('([\)\]]$)', '', $time1);
  $time2 = preg_replace('`^([\(\[])`', '', $dates['value2']['formatted_time']);
  $time2 = preg_replace('([\)\]]$)', '', $time2);

  // A date with a granularity of 'hour' has a time string that is an integer
  // value. We can't use that to replace time strings in formatted dates.
  $has_time_string = date_has_time($field['settings']['granularity']);
  if ($precision == 'hour') {
    $has_time_string = FALSE;
  }

  // No date values, display nothing.
  if (empty($date1) && empty($date2)) {
    $output .= '';
  }
  // Start and End dates match or there is no End date, display a complete
  // single date.
  elseif ($date1 == $date2 || empty($date2)) {
    $output .= theme('date_display_single', array(
      'date' => $date1,
      'timezone' => $timezone,
      'attributes' => $attributes,
      'rdf_mapping' => $rdf_mapping,
      'add_rdf' => $add_rdf,
      'microdata' => $microdata,
      'add_microdata' => $add_microdata,
      'dates' => $dates,
    ));
  }
  // Same day, different times, don't repeat the date but show both Start and
  // End times. We can NOT do this if the replacement value is an integer
  // instead of a time string.
  elseif ($has_time_string && $dates['value']['formatted_date'] == $dates['value2']['formatted_date']) {
    // Replace the original time with the start/end time in the formatted start
    // date. Make sure that parentheses or brackets wrapping the time will be
    // retained in the final result.
    $time = theme('date_display_range', array(
      'date1' => $time1,
      'date2' => $time2,
      'timezone' => $timezone,
      'attributes' => $attributes,
      'rdf_mapping' => $rdf_mapping,
      'add_rdf' => $add_rdf,
      'microdata' => $microdata,
      'add_microdata' => $add_microdata,
      'dates' => $dates,
    ));
    $replaced = str_replace($time1, $time, $date1);
    $output .= theme('date_display_single', array(
      'date' => $replaced,
      'timezone' => $timezone,
      'attributes' => array(),
      'rdf_mapping' => array(),
      'add_rdf' => FALSE,
      'dates' => $dates,
    ));
  }
  // Different days, display both in their entirety.
  else {
    $output .= theme('date_display_range', array(
      'date1' => $date1,
      'date2' => $date2,
      'timezone' => $timezone,
      'attributes' => $attributes,
      'rdf_mapping' => $rdf_mapping,
      'add_rdf' => $add_rdf,
      'microdata' => $microdata,
      'add_microdata' => $add_microdata,
      'dates' => $dates,
    ));
  }

  return $output;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.