You are here

function forum_access_node_update in Forum Access 8

Same name and namespace in other branches
  1. 7 forum_access.module \forum_access_node_update()

Implements hook_ENTITY_TYPE_update() for node entities.

@inheritdoc

File

./forum_access.module, line 240
Contains forum_access.module.

Code

function forum_access_node_update(EntityInterface $entity) {
  if ($entity
    ->bundle() != 'forum') {
    return;
  }
  module_load_include('inc', 'forum_access', 'includes/forum_access.common');
  $old_tid = forum_access_get_tid($entity->original);
  $current_tid = forum_access_get_tid($entity);
  if (isset($old_tid)) {
    if ($current_tid == $old_tid) {
      return;
    }
    acl_node_clear_acls($entity
      ->id(), 'forum_access');
  }

  // For changed and for previously unassigned terms we need to fake an insert.
  forum_access_node_insert($entity);
}