1 date.admin.inc date_default_formatter_settings_summary($field, $instance, $view_mode)

Settings summary for the default formatter.

File

core/modules/date/date.admin.inc, line 123
Admin page callbacks for the Date module.

Code

function date_default_formatter_settings_summary($field, $instance, $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $formatter = $display['type'];
  $format_types = date_format_type_options();
  $summary = array();
  $format = FALSE;
  switch ($formatter) {
    case 'date_plain':
      $format = t('Plain');
      break;

    case 'format_interval':
      $format = t('Interval');
      break;

    default:
      if (!empty($format_types[$settings['format_type']])) {
        $format = $format_types[$settings['format_type']];
      }
  }
  if ($format) {
    $summary[] = t('Display dates using the @format format', array('@format' => $format));
  }
  else {
    $summary[] = t('Display dates using the default format because the specified format (@format) is not defined', array('@format' => $settings['format_type']));
  }

  if (array_key_exists('fromto', $settings) && $field['settings']['todate']) {
    $options = array(
      'both' => t('Display both Start and End dates'),
      'value' => t('Display Start date only'),
      'value2' => t('Display End date only'),
    );
    if (isset($options[$settings['fromto']])) {
      $summary[] = $options[$settings['fromto']];
    }
  }

  if (array_key_exists('multiple_number', $settings) && !empty($field['cardinality'])) {
    $summary[] = t('Show @count value(s) starting with @date1, ending with @date2', array(
      '@count' => !empty($settings['multiple_number']) ? $settings['multiple_number'] : t('all'),
      '@date1' => !empty($settings['multiple_from']) ? $settings['multiple_from'] : t('earliest'),
      '@date2' => !empty($settings['multiple_to']) ? $settings['multiple_to'] : t('latest'),
    ));
  }

  if (array_key_exists('show_remaining_days', $settings)) {
    $summary[] = t('Show remaining days: @value', array('@value' => ($settings['show_remaining_days'] ? 'yes' : 'no')));
  }

  return $summary;
}