function TempStoreTrait::getDateFormatter

Retrieves the date formatter service if not already present.

Return value

\Drupal\Core\Datetime\DateFormatterInterface The service.

File

src/Ui/TempStoreTrait.php, line 108

Class

TempStoreTrait
Provides methods for modified rules components in temporary storage.

Namespace

Drupal\rules\Ui

Code

protected function getDateFormatter() {
    if (!isset($this->dateFormatter)) {
        $this->dateFormatter = \Drupal::service('date.formatter');
    }
    return $this->dateFormatter;
}