You are here

public function DateRangeAllDayTrait::settingsSummary in Date all day 8

File

src/Plugin/Field/FieldFormatter/DateRangeAllDayTrait.php, line 104

Class

DateRangeAllDayTrait
A viewElements method, that respects an empty end date.

Namespace

Drupal\date_all_day\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($date_only_format = $this
    ->getSetting('date_only_format')) {
    $date = new DrupalDateTime();
    $this
      ->setTimeZone($date);
    $formatted_date = $this->dateFormatter
      ->format($date
      ->getTimestamp(), $date_only_format);
    $summary[] = $this
      ->t('Date only format: %date', [
      '%date' => $formatted_date,
    ]);
  }
  return $summary;
}