1.20.x date.api.php hook_date_field_formatter_settings_summary_alter(&$summary, $context)

Alter a date field formatter settings summary.

Parameters

array $summary: An array of strings to be concatenated into a short summary of the formatter settings.

array $context: An associative array containing the following keys:

  • field: The $field array.
  • instance: The $instance array.
  • view_mode: The formatter display mode.

See also

hook_field_formatter_settings_summary()

File

modules/date/date.api.php, line 496
Hooks provided by the Date module.

Code

function hook_date_field_formatter_settings_summary_alter(&$summary, $context) {
  $field = $context['field'];
  $instance = $context['instance'];
  $view_mode = $context['view_mode'];
  $display = $instance['display'][$view_mode];
  $formatter = $display['type'];
  $settings = $display['settings'];
  if (isset($settings['show_repeat_rule']) && !empty($field['settings']['repeat'])) {
    if ($settings['show_repeat_rule'] == 'show') {
      $summary[] = t('Show repeat rule');
    }
    else {
      $summary[] = t('Hide repeat rule');
    }
  }
}