public function CommentAccessTrait::noAccessAdministerComment in Comment Permissions 8
Check if user doesn't have access to administer comments.
Parameters
\Drupal\Core\Session\AccountInterface $account: User account proxy.
$comment_type: Comment entity type.
Return value
bool TRUE user doesn't have administer comments permisison, FALSE otherwise.
3 calls to CommentAccessTrait::noAccessAdministerComment()
- CommentForm::save in src/
CommentForm.php - Form submission handler for the 'save' action.
- CommentStorage::getDisplayOrdinal in src/
CommentStorage.php - Gets the display ordinal or page number for a comment.
- CommentStorage::loadThread in src/
CommentStorage.php - To display threaded comments in the correct order we keep a 'thread' field and order by that value. This field keeps this data in a way which is easy to update and convenient to use.
File
- src/
CommentAccessTrait.php, line 42
Class
- CommentAccessTrait
- Class CommentAccessTrait
Namespace
Drupal\comment_permCode
public function noAccessAdministerComment(AccountInterface $account, $comment_type) {
if (!$account
->hasPermission('administer comments') && !$account
->hasPermission("administer {$comment_type} comments")) {
return TRUE;
}
return FALSE;
}