function FilterFormatRepository::getFallbackFormatId

Same name and namespace in other branches
  1. 11.x core/modules/filter/src/FilterFormatRepository.php \Drupal\filter\FilterFormatRepository::getFallbackFormatId()

File

core/modules/filter/src/FilterFormatRepository.php, line 106

Class

FilterFormatRepository
Provides a repository service for filter formats.

Namespace

Drupal\filter

Code

public function getFallbackFormatId() : ?string {
  // This variable is automatically set in the database for all installations
  // of Drupal. In the event that it gets disabled or deleted somehow, there
  // is no safe default to return, since we do not want to risk making an
  // existing (and potentially unsafe) text format on the site automatically
  // available to all users. Returning NULL at least guarantees that this
  // cannot happen.
  return $this->configFactory
    ->get('filter.settings')
    ->get('fallback_format');
}

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