public function CommentAccessTrait::accessAdministerCommentType in Comment Permissions 8
Check if user has access to administer comment type.
Parameters
\Drupal\Core\Session\AccountInterface $account: User account proxy.
$comment_type: Comment entity type.
Return value
bool TRUE user has access to administer comment type, FALSE otherwise.
File
- src/
CommentAccessTrait.php, line 61
Class
- CommentAccessTrait
- Class CommentAccessTrait
Namespace
Drupal\comment_permCode
public function accessAdministerCommentType(AccountInterface $account, $comment_type) {
if ($account
->hasPermission('administer comment type') || $account
->hasPermission("administer {$comment_type} comment type")) {
return TRUE;
}
return FALSE;
}