You are here

protected function StoreDateTimeFormatter::getDateFormat in Commerce Core 8.2

Gets the configured date format.

Return value

\Drupal\Core\Datetime\DateFormatInterface The date format.

1 call to StoreDateTimeFormatter::getDateFormat()
StoreDateTimeFormatter::settingsSummary in modules/store/src/Plugin/Field/FieldFormatter/StoreDateTimeFormatter.php
Returns a short summary for the current formatter settings.

File

modules/store/src/Plugin/Field/FieldFormatter/StoreDateTimeFormatter.php, line 195

Class

StoreDateTimeFormatter
Plugin implementation of the 'commerce_store_datetime' formatter.

Namespace

Drupal\commerce_store\Plugin\Field\FieldFormatter

Code

protected function getDateFormat() {

  /** @var \Drupal\Core\Datetime\DateFormatInterface $date_format */
  $date_format = $this->dateFormatStorage
    ->load($this
    ->getSetting('date_format'));
  if (!$date_format) {

    // Guard against missing/deleted date formats.
    $date_format = $this->dateFormatStorage
      ->load('fallback');
  }
  return $date_format;
}