ContactPermissionsPermissions.php in Contact Permissions 8.2
File
src/ContactPermissionsPermissions.php
View source
<?php
namespace Drupal\contact_permissions;
use Drupal\Core\StringTranslation\StringTranslationTrait;
class ContactPermissionsPermissions {
use StringTranslationTrait;
public function permissions() {
$permissions = [];
$roles = user_roles(TRUE);
if (count($roles) < 1) {
return $permissions;
}
foreach ($roles as $role) {
$role_name = $role
->label();
$role_id = $role
->id();
$permissions["use {$role_id} personal contact forms"] = [
'title' => $this
->t("Use %role_name's personal contact forms", [
'%role_name' => $role_name,
]),
];
}
return $permissions;
}
}