function FilterFormatRepository::getFormatsByRole

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

File

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

Class

FilterFormatRepository
Provides a repository service for filter formats.

Namespace

Drupal\filter

Code

public function getFormatsByRole(string $roleId) : array {
  return array_filter($this->getAllFormats(), fn(FilterFormatInterface $format): bool => isset($format->getRoles()[$roleId]));
}

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