You are here

function hook_date_field_formatter_settings_summary_alter in Date 8

Same name and namespace in other branches
  1. 7.3 date.api.php \hook_date_field_formatter_settings_summary_alter()
  2. 7.2 date.api.php \hook_date_field_formatter_settings_summary_alter()

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 view mode.

See also

hook_field_formatter_settings_summary()

1 function implements hook_date_field_formatter_settings_summary_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

date_repeat_field_date_field_formatter_settings_summary_alter in date_repeat_field/date_repeat_field.module
Implements hook_date_field_foramatter_settings_summary_alter().
4 invocations of hook_date_field_formatter_settings_summary_alter()
DateDefaultFormatter::settingsSummary in lib/Drupal/date/Plugin/field/formatter/DateDefaultFormatter.php
Settings summary for the default formatter.
DateFieldDefaultFormatter::settingsSummary in date_field/lib/Drupal/date_field/Plugin/field/formatter/DateFieldDefaultFormatter.php
Settings summary for the default formatter.
DateFieldFormatIntervalFormatter::settingsSummary in date_field/lib/Drupal/date_field/Plugin/field/formatter/DateFieldFormatIntervalFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsSummary().
FormatIntervalFormatter::settingsSummary in lib/Drupal/date/Plugin/field/formatter/FormatIntervalFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsSummary().

File

./date.api.php, line 475
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'];
  $formatter = $context['formatter'];
  $settings = $context['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');
    }
  }
}