You are here

protected function NodeOptionPremiumPermissions::buildPermissions in Node Option Premium 8

Returns a list of node permissions for a given node type.

Parameters

\Drupal\node\Entity\NodeType $type: The node type.

Return value

array An associative array of permission names and descriptions.

1 call to NodeOptionPremiumPermissions::buildPermissions()
NodeOptionPremiumPermissions::nodeTypePermissions in src/NodeOptionPremiumPermissions.php
Returns an array of node type permissions.

File

src/NodeOptionPremiumPermissions.php, line 42

Class

NodeOptionPremiumPermissions
Provides dynamic permissions for nodes of different types for promoted.

Namespace

Drupal\nopremium

Code

protected function buildPermissions(NodeType $type) {
  $type_id = $type
    ->id();
  $type_params = [
    '%type_name' => $type
      ->label(),
  ];
  return [
    "view full {$type_id} premium content" => [
      'title' => $this
        ->t('%type_name: View full premium content', $type_params),
    ],
    "override {$type_id} premium content" => [
      'title' => $this
        ->t('%type_name: Override premium option', $type_params),
    ],
  ];
}