function TimestampFormatter::getRefreshIntervals

Same name in other branches
  1. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter::getRefreshIntervals()

Returns the refresh interval options for the time difference display.

Return value

\Drupal\Component\Render\MarkupInterface[] A list of refresh time intervals.

2 calls to TimestampFormatter::getRefreshIntervals()
TimestampFormatter::settingsForm in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php
Returns a form to configure settings for the formatter.
TimestampFormatter::settingsSummary in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php
Returns a short summary for the current formatter settings.

File

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

Class

TimestampFormatter
Plugin implementation of the 'timestamp' formatter.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

protected function getRefreshIntervals() : array {
    return [
        0 => $this->t('No refresh'),
        1 => $this->t('1 second'),
        15 => $this->t('@count seconds', [
            '@count' => 15,
        ]),
        60 => $this->t('1 minute'),
        300 => $this->t('@count minutes', [
            '@count' => 5,
        ]),
        600 => $this->t('@count minutes', [
            '@count' => 10,
        ]),
    ];
}

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