You are here

protected function SubscriptionPermissionProvider::buildEntityTypePermissions in Commerce Recurring Framework 8

Builds permissions for the entity_type granularity.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

array The permissions.

Overrides UncacheableEntityPermissionProvider::buildEntityTypePermissions

File

src/SubscriptionPermissionProvider.php, line 16

Class

SubscriptionPermissionProvider
Provides additional permissions for subscriptions.

Namespace

Drupal\commerce_recurring

Code

protected function buildEntityTypePermissions(EntityTypeInterface $entity_type) {
  $permissions = parent::buildEntityTypePermissions($entity_type);
  $entity_type_id = $entity_type
    ->id();
  $plural_label = $entity_type
    ->getPluralLabel();
  $permissions["cancel any {$entity_type_id}"] = [
    'title' => $this
      ->t('Cancel any @type', [
      '@type' => $plural_label,
    ]),
  ];
  $permissions["cancel own {$entity_type_id}"] = [
    'title' => $this
      ->t('Cancel own @type', [
      '@type' => $plural_label,
    ]),
  ];
  return $permissions;
}