You are here

function date_default_formatter_settings_summary in Date 7

Same name and namespace in other branches
  1. 7.3 date_admin.inc \date_default_formatter_settings_summary()
  2. 7.2 date_admin.inc \date_default_formatter_settings_summary()

Settings summary for the default formatter.

1 call to date_default_formatter_settings_summary()
date_field_formatter_settings_summary in ./date.field.inc
Implements hook_field_formatter_settings_summary().

File

./date_admin.inc, line 110
Date administration code. Moved to separate file since there is a lot of code here that is not needed often.

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();
  $summary[] = t('Use the @format format type.', array(
    '@format' => $format_types[$settings['format_type']],
  ));
  $options = array(
    'both' => t('Display both From and To dates'),
    'value' => t('Display From date only'),
    'value2' => t('Display To date only'),
  );
  $summary[] = $options[$settings['fromto']];
  if (!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 (!empty($field['repeat'])) {
    if (!empty($settings['show_repeat_rule'])) {
      $summary[] = t('Show repeat rule');
    }
    else {
      $summary[] = t('Do not show repeat rule');
    }
  }
  return implode('<br />', $summary);
}