You are here

protected function ParagraphsTypePermissions::buildPermissions in Paragraphs 8

Builds a standard list of node permissions for a given type.

Parameters

\Drupal\paragraphs\Entity\ParagraphsType $type: The machine name of the node type.

Return value

array An array of permission names and descriptions.

1 call to ParagraphsTypePermissions::buildPermissions()
ParagraphsTypePermissions::paragraphTypePermissions in modules/paragraphs_type_permissions/src/ParagraphsTypePermissions.php
Returns an array of Paragraphs type permissions.

File

modules/paragraphs_type_permissions/src/ParagraphsTypePermissions.php, line 54

Class

ParagraphsTypePermissions
Defines a class containing permission callbacks.

Namespace

Drupal\paragraphs_type_permissions

Code

protected function buildPermissions(ParagraphsType $type) {
  $type_id = $type
    ->id();
  $type_params = array(
    '%type_name' => $type
      ->label(),
  );
  return array(
    'view paragraph content ' . $type_id => array(
      'title' => $this
        ->t('%type_name: View content', $type_params),
      'description' => $this
        ->t('Is able to view Paragraphs content of type %type_name', $type_params),
    ),
    'create paragraph content ' . $type_id => array(
      'title' => $this
        ->t('%type_name: Create content', $type_params),
      'description' => $this
        ->t('Is able to create Paragraphs content of type %type_name', $type_params),
    ),
    'update paragraph content ' . $type_id => array(
      'title' => $this
        ->t('%type_name: Edit content', $type_params),
      'description' => $this
        ->t('Is able to update Paragraphs content of type %type_name', $type_params),
    ),
    'delete paragraph content ' . $type_id => array(
      'title' => $this
        ->t('%type_name: Delete content', $type_params),
      'description' => $this
        ->t('Is able to delete Paragraphs content of type %type_name', $type_params),
    ),
  );
}