You are here

public function EntityClonePermissions::permissions in Entity Clone 8

Returns an array of entity_clone permissions.

Return value

array The permission list.

1 string reference to 'EntityClonePermissions::permissions'
entity_clone.permissions.yml in ./entity_clone.permissions.yml
entity_clone.permissions.yml

File

src/EntityClonePermissions.php, line 70

Class

EntityClonePermissions
Provides dynamic permissions of the entity_clone module.

Namespace

Drupal\entity_clone

Code

public function permissions() {
  $permissions = [];
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    $permissions['clone ' . $entity_type_id . ' entity'] = $this->translationManager
      ->translate('Clone all <em>@label</em> entities.', [
      '@label' => $entity_type
        ->getLabel(),
    ]);
    if ($this->serviceProvider
      ->entityTypeHasOwnerTrait($entity_type)) {
      $permissions['take_ownership_on_clone ' . $entity_type_id . ' entity'] = $this->translationManager
        ->translate('Allow user to take ownership of  <em>@label</em> cloned entities', [
        '@label' => $entity_type
          ->getLabel(),
      ]);
    }
  }
  return $permissions;
}