function DateTimeFormatterBase::getFormatSettings

Same name in other branches
  1. 8.9.x core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase::getFormatSettings()
  2. 10 core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase::getFormatSettings()
  3. 11.x core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase::getFormatSettings()

Gets a settings array suitable for DrupalDateTime::format().

Return value

array The settings array that can be passed to DrupalDateTime::format().

1 call to DateTimeFormatterBase::getFormatSettings()
DateTimeCustomFormatter::settingsSummary in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeCustomFormatter.php
Returns a short summary for the current formatter settings.

File

core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php, line 182

Class

DateTimeFormatterBase
Base class for 'DateTime Field formatter' plugin implementations.

Namespace

Drupal\datetime\Plugin\Field\FieldFormatter

Code

protected function getFormatSettings() {
    $settings = [];
    if ($this->getSetting('timezone_override') != '') {
        $settings['timezone'] = $this->getSetting('timezone_override');
    }
    return $settings;
}

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