public function CommentAccessTrait::accessAdministerComment in Comment Permissions 8
Check if user has access to administer comments.
Parameters
\Drupal\Core\Session\AccountInterface $account: User account proxy.
$comment_type: Comment entity type.
Return value
bool TRUE user has access to administer comments, FALSE otherwise.
9 calls to CommentAccessTrait::accessAdministerComment()
- CommentDefaultFormatter::viewElements in src/Plugin/ Field/ FieldFormatter/ CommentDefaultFormatter.php 
- Builds a renderable array for a field value.
- CommentFieldItemList::access in src/CommentFieldItemList.php 
- Checks data value access.
- CommentForm::actions in src/CommentForm.php 
- Returns an array of supported actions for the current entity form.
- CommentForm::buildEntity in src/CommentForm.php 
- Builds an updated entity object based upon the submitted form values.
- CommentForm::form in src/CommentForm.php 
- Gets the actual form array to be built.
File
- src/CommentAccessTrait.php, line 23 
Class
- CommentAccessTrait
- Class CommentAccessTrait
Namespace
Drupal\comment_permCode
public function accessAdministerComment(AccountInterface $account, $comment_type) {
  if ($account
    ->hasPermission('administer comments') || $account
    ->hasPermission("administer {$comment_type} comments")) {
    return TRUE;
  }
  return FALSE;
}