function FilterFormatRepository::getDefaultFormat

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

File

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

Class

FilterFormatRepository
Provides a repository service for filter formats.

Namespace

Drupal\filter

Code

public function getDefaultFormat(?AccountInterface $account = NULL) : FilterFormatInterface {
  // Get a list of formats for this user, ordered by weight. The first one
  // available is the user's default format.
  $formats = $this->getFormatsForAccount($account ?? $this->currentUser);
  return reset($formats);
}

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