You are here

public function PdfUsingMpdfNodeTypePermissions::createPerm in PDF using mPDF 8.2

Create node type permissions

Parameters

array $types:

Return value

array[]

1 call to PdfUsingMpdfNodeTypePermissions::createPerm()
PdfUsingMpdfNodeTypePermissions::accessPermissions in src/PdfUsingMpdfNodeTypePermissions.php
Return permissions

File

src/PdfUsingMpdfNodeTypePermissions.php, line 63

Class

PdfUsingMpdfNodeTypePermissions
Generate permissions dynamically for various content types

Namespace

Drupal\pdf_using_mpdf

Code

public function createPerm($types) {
  $permissions = [];
  foreach ($types as $type) {
    $perm = [
      'generate ' . $type['id'] . ' pdf' => [
        'title' => $this
          ->t('%type_name: Generate PDF using mPDF', [
          '%type_name' => $type['label'],
        ]),
      ],
    ];
    $permissions += $perm;
  }

  //    echo '<pre>';print_r($permissions);die;
  return $permissions;
}