function photos_node_update in Album Photos 6.0.x
Same name and namespace in other branches
- 8.5 photos.module \photos_node_update()
- 8.4 photos.module \photos_node_update()
- 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());
}
}