You are here

public function TcaPermissionGenerator::permissions in Token Content Access 8

Same name and namespace in other branches
  1. 2.0.x src/TcaPermissionGenerator.php \Drupal\tca\TcaPermissionGenerator::permissions()

Return an array of per-entity tca permissions.

Return value

array An array of permissions

1 string reference to 'TcaPermissionGenerator::permissions'
tca.permissions.yml in ./tca.permissions.yml
tca.permissions.yml

File

src/TcaPermissionGenerator.php, line 64

Class

TcaPermissionGenerator
Class TcaPermissionGenerator.

Namespace

Drupal\tca

Code

public function permissions() {
  $permissions = [];
  foreach ($this->tcaPluginManager
    ->getDefinitions() as $def) {
    $entity_type = $this->entityTypeManager
      ->getStorage($def['entityType'])
      ->getEntityType();
    $permissions += [
      'tca administer ' . $def['entityType'] => [
        'title' => $this
          ->t('Administer Token Content Access settings for %entity_type', [
          '%entity_type' => $entity_type
            ->getLabel(),
        ]),
      ],
      'tca bypass ' . $def['entityType'] => [
        'title' => $this
          ->t('Bypass Token Content Access action for %entity_type', [
          '%entity_type' => $entity_type
            ->getLabel(),
        ]),
      ],
    ];
  }
  return $permissions;
}