You are here

function photos_access_node_delete in Album Photos 8.4

Same name and namespace in other branches
  1. 8.5 photos_access/photos_access.module \photos_access_node_delete()
  2. 7.3 photos_access/photos_access.module \photos_access_node_delete()
  3. 6.0.x photos_access/photos_access.module \photos_access_node_delete()

Implements hook_node_delete().

File

photos_access/photos_access.module, line 600
Implementation of photos_access.module.

Code

function photos_access_node_delete(NodeInterface $node) {
  $db = \Drupal::database();
  $db
    ->delete('photos_access_album')
    ->condition('nid', $node
    ->id())
    ->execute();
  if (isset($node->privacy['vid'])) {
    $db
      ->delete('photos_access_user')
      ->condition('id', $node->privacy['vid'])
      ->execute();
  }
  if (isset($node->privacy['eid'])) {
    $db
      ->delete('photos_access_user')
      ->condition('id', $node->privacy['eid'])
      ->execute();
  }
}