You are here

public function Access::commentReply in Forum Access 8

Access for comment reply according to the taxonomy term of forum.

File

src/ForumAccess/Access.php, line 47

Class

Access
Access checks for forum.

Namespace

Drupal\forum_access\ForumAccess

Code

public function commentReply(EntityInterface $entity, $field_name, $pid = NULL) {
  if ($entity
    ->bundle() != 'forum') {
    return AccessResult::allowed();
  }

  // Forbid if user has no access to reply.
  if (!forum_access_entity_access_by_tid('create', $entity)) {
    return AccessResult::forbidden();
  }
  return AccessResult::allowed();
}