You are here

function photos_node_update in Album Photos 6.0.x

Same name and namespace in other branches
  1. 8.5 photos.module \photos_node_update()
  2. 8.4 photos.module \photos_node_update()
  3. 7.3 photos.module \photos_node_update()

Implements hook_ENTITY_TYPE_update().

File

./photos.module, line 582
Implementation of photos.module.

Code

function photos_node_update(NodeInterface $node) {
  if ($node
    ->getType() == 'photos') {
    $album_data = $node->album;
    unset($album_data['cover']);
    $db = \Drupal::database();
    $db
      ->update('photos_album')
      ->fields([
      'data' => serialize($album_data),
    ])
      ->condition('album_id', $node
      ->id())
      ->execute();
    PhotosAlbum::setCount('user_album', $node
      ->getOwnerId());
  }
}