You are here

protected function GroupContentPermissionProvider::buildPermission in Group 8

Builds a permission with common translation arguments predefined.

Parameters

string $title: The permission title.

string $description: (optional) The permission description.

Return value

array The permission with a default translatable markup replacement for both %plugin_name and %entity_type.

1 call to GroupContentPermissionProvider::buildPermission()
GroupContentPermissionProvider::buildPermissions in src/Plugin/GroupContentPermissionProvider.php
Provides a list of group permissions the plugin exposes.

File

src/Plugin/GroupContentPermissionProvider.php, line 289

Class

GroupContentPermissionProvider
Provides group permissions for GroupContent entities.

Namespace

Drupal\group\Plugin

Code

protected function buildPermission($title, $description = NULL) {
  $t_args = [
    '%plugin_name' => $this->definition['label'],
    '%entity_type' => $this->entityType
      ->getSingularLabel(),
  ];
  $permission['title'] = $title;
  $permission['title_args'] = $t_args;
  if (isset($description)) {
    $permission['description'] = $description;
    $permission['description_args'] = $t_args;
  }
  return $permission;
}