You are here

function opigno_forum_taxonomy_term_access in Opigno forum 8

Same name and namespace in other branches
  1. 3.x opigno_forum.module \opigno_forum_taxonomy_term_access()

Implements hook_ENTITY_TYPE_access().

File

./opigno_forum.module, line 167
Contains opigno_forum.module.

Code

function opigno_forum_taxonomy_term_access(TermInterface $entity, $operation, AccountInterface $account) {
  if ($entity
    ->bundle() === 'forums') {

    // Check current user access to the forum taxonomy term.
    $tid = $entity
      ->id();
    return AccessResult::forbiddenIf(!_opigno_forum_access($tid, $account));
  }
  return AccessResult::neutral();
}