function DateTimeRangeTrait::dateTimeRangeSettingsSummary

Same name in other branches
  1. 10 core/modules/datetime_range/src/DateTimeRangeTrait.php \Drupal\datetime_range\DateTimeRangeTrait::dateTimeRangeSettingsSummary()

Gets the date time range settings summary.

Return value

array An array of summary messages.

3 calls to DateTimeRangeTrait::dateTimeRangeSettingsSummary()
DateRangeCustomFormatter::settingsSummary in core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangeCustomFormatter.php
Returns a short summary for the current formatter settings.
DateRangeDefaultFormatter::settingsSummary in core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangeDefaultFormatter.php
Returns a short summary for the current formatter settings.
DateRangePlainFormatter::settingsSummary in core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangePlainFormatter.php
Returns a short summary for the current formatter settings.

File

core/modules/datetime_range/src/DateTimeRangeTrait.php, line 98

Class

DateTimeRangeTrait
Provides friendly methods for datetime range.

Namespace

Drupal\datetime_range

Code

protected function dateTimeRangeSettingsSummary() : array {
    $summary = [];
    if ($from_to = $this->getSetting('from_to')) {
        $from_to_options = $this->getFromToOptions();
        if (isset($from_to_options[$from_to])) {
            $summary[] = $from_to_options[$from_to];
        }
    }
    if (($separator = $this->getSetting('separator')) && $this->getSetting('from_to') === DateTimeRangeConstantsInterface::BOTH) {
        $summary[] = $this->t('Separator: %separator', [
            '%separator' => $separator,
        ]);
    }
    return $summary;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.