You are here

public function DateTimeCustomFormatter::settingsSummary in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeCustomFormatter.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeCustomFormatter::settingsSummary()

Returns a short summary for the current formatter settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.

Return value

string[] A short summary of the formatter settings.

Overrides DateTimeFormatterBase::settingsSummary

File

core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeCustomFormatter.php, line 97
Contains \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeCustomFormatter.

Class

DateTimeCustomFormatter
Plugin implementation of the 'Custom' formatter for 'datetime' fields.

Namespace

Drupal\datetime\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $date = new DrupalDateTime();
  $this
    ->setTimeZone($date);
  $summary[] = $date
    ->format($this
    ->getSetting('date_format'), $this
    ->getFormatSettings());
  return $summary;
}