You are here

protected function MessagePermissions::buildPermissions in Message UI 8

Builds a standard list of message permissions for a given template.

Parameters

\Drupal\message\Entity\MessageTemplate $template: The machine name of the message template.

Return value

array An array of permission names and descriptions.

1 call to MessagePermissions::buildPermissions()
MessagePermissions::messageTemplatePermissions in src/MessagePermissions.php
Gets an array of message type permissions.

File

src/MessagePermissions.php, line 43

Class

MessagePermissions
Defines a class containing permission callbacks.

Namespace

Drupal\message_ui

Code

protected function buildPermissions(MessageTemplate $template) {
  $template_params = [
    '%template_name' => $template
      ->label(),
  ];
  return [
    'view ' . $template
      ->id() . ' message' => [
      'title' => $this
        ->t('%template_name: View a message instance', $template_params),
    ],
    'edit ' . $template
      ->id() . ' message' => [
      'title' => $this
        ->t('%template_name: Edit a message instance', $template_params),
    ],
    'create ' . $template
      ->id() . ' message' => [
      'title' => $this
        ->t('%template_name: Create a new message instance', $template_params),
    ],
    'delete ' . $template
      ->id() . ' message' => [
      'title' => $this
        ->t('%template_name: Delete a message instance', $template_params),
    ],
  ];
}