You are here

function filebrowser_node_update in Filebrowser 8.2

Same name and namespace in other branches
  1. 3.x filebrowser.module \filebrowser_node_update()

Implements hook_ENTITY_TYPE_update() for node entities.

File

./filebrowser.module, line 187

Code

function filebrowser_node_update(NodeInterface $node) {

  /** @var \Drupal\filebrowser\FilebrowserManager $manager */
  if ($node
    ->bundle() == 'dir_listing') {
    $node->filebrowser->nid = $node
      ->id();
    $manager = \Drupal::service('filebrowser.manager');

    //print_r($node->filebrowser);
    $manager
      ->updateFilebrowser($node->filebrowser, 'edit');

    // invalidate the cache for this node
    \Drupal\Core\Cache\Cache::invalidateTags([
      'filebrowser:node:' . $node
        ->id(),
    ]);
  }
}