You are here

protected function ConnectionPermissions::buildListingPermissions in RedHen CRM 8

Builds a list of permissions for a the Connections tab per entity.

Return value

array An array of permission names and descriptions.

1 call to ConnectionPermissions::buildListingPermissions()
ConnectionPermissions::ConnectionTypePermissions in modules/redhen_connection/src/ConnectionPermissions.php
Returns an array of RedHen Connection type permissions.

File

modules/redhen_connection/src/ConnectionPermissions.php, line 67

Class

ConnectionPermissions

Namespace

Drupal\redhen_connection

Code

protected function buildListingPermissions() {
  $permissions = [];
  foreach (\Drupal::service('redhen_connection.connections')
    ->getAllConnectionEntityTypes() as $entity_type_id => $entity_type) {

    // If the entity didn't get a redhen_connection link template added by
    // hook_entity_types_alter(), skip it.
    if (!($path = $entity_type
      ->getLinkTemplate('redhen_connection'))) {
      continue;
    }
    $permissions["view own active {$entity_type_id} connection"] = [
      'title' => $this
        ->t('%type: View own active connections', [
        '%type' => $entity_type
          ->getLabel(),
      ]),
    ];
  }
  return $permissions;
}