You are here

public function BetterFormatsPermissions::permissions in Better Formats 8

Returns an array of better formats permissions.

Return value

array

1 string reference to 'BetterFormatsPermissions::permissions'
better_formats.permissions.yml in ./better_formats.permissions.yml
better_formats.permissions.yml

File

src/BetterFormatsPermissions.php, line 46

Class

BetterFormatsPermissions
Provides dynamic permissions of the better formats module.

Namespace

Drupal\better_formats

Code

public function permissions() {
  $permissions = [];

  // Generate permissions for each entity type.
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if ($entity_type
      ->get('field_ui_base_route')) {
      $permissions['hide format selection for ' . $entity_type_id] = [
        'title' => $this
          ->t('Hide format selection for @label', [
          '@label' => $entity_type
            ->getLabel(),
        ]),
      ];
    }
  }
  return $permissions;
}