You are here

public function CommentPermissions::commentTypePermissions in Comment Permissions 8

Returns an array of comment type permissions.

Return value

array The comment type permissions @see \Drupal\user\PermissionHandlerInterface::getPermissions()

1 string reference to 'CommentPermissions::commentTypePermissions'
comment_perm.permissions.yml in ./comment_perm.permissions.yml
comment_perm.permissions.yml

File

src/CommentPermissions.php, line 22

Class

CommentPermissions
Provide dynamic permissions for comments of different types.

Namespace

Drupal\comment_perm

Code

public function commentTypePermissions() {
  $perm = array();

  // Generate comment permissions for all comment types.
  foreach (CommentType::loadMultiple() as $type) {
    $perm += $this
      ->buildPermissions($type);
  }
  return $perm;
}