function TimestampFormatter::settingsSummary

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter::settingsSummary()
  2. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter::settingsSummary()
  3. 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter::settingsSummary()

Overrides FormatterBase::settingsSummary

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php, line 144

Class

TimestampFormatter
Plugin implementation of the 'timestamp' formatter.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
    $summary = parent::settingsSummary();
    $date_format = $this->getSetting('date_format');
    $summary[] = $this->t('Date format: @date_format', [
        '@date_format' => $date_format,
    ]);
    if ($this->getSetting('date_format') === 'custom' && ($custom_date_format = $this->getSetting('custom_date_format'))) {
        $summary[] = $this->t('Custom date format: @custom_date_format', [
            '@custom_date_format' => $custom_date_format,
        ]);
    }
    if ($timezone = $this->getSetting('timezone')) {
        $summary[] = $this->t('Time zone: @timezone', [
            '@timezone' => $timezone,
        ]);
    }
    return $summary;
}

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