You are here

class SubscriptionPermissionProvider in Commerce Recurring Framework 8

Provides additional permissions for subscriptions.

Hierarchy

Expanded class hierarchy of SubscriptionPermissionProvider

File

src/SubscriptionPermissionProvider.php, line 11

Namespace

Drupal\commerce_recurring
View source
class SubscriptionPermissionProvider extends UncacheableEntityPermissionProvider {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityPermissionProviderBase::$entityTypeBundleInfo protected property The entity type bundle info.
EntityPermissionProviderBase::buildPermissions public function Builds permissions for the given entity type. Overrides EntityPermissionProviderInterface::buildPermissions
EntityPermissionProviderBase::createInstance public static function Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface::createInstance
EntityPermissionProviderBase::processPermissions protected function Adds the provider and converts the titles to strings to allow sorting.
EntityPermissionProviderBase::__construct public function Constructs a new EntityPermissionProvider object.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
SubscriptionPermissionProvider::buildEntityTypePermissions protected function Builds permissions for the entity_type granularity. Overrides UncacheableEntityPermissionProvider::buildEntityTypePermissions
UncacheableEntityPermissionProvider::buildBundlePermissions protected function Builds permissions for the bundle granularity. Overrides EntityPermissionProviderBase::buildBundlePermissions