Same name in other branches
  1. 8.x-1.x src/EntityClonePermissions.php \Drupal\entity_clone\EntityClonePermissions::permissions()

Returns an array of entity_clone permissions.

Return value

array The permission list.

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

Fichier

src/EntityClonePermissions.php, line 70

Classe

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;
}