function prevnext_node_presave in Prevnext 8
Same name and namespace in other branches
- 2.x prevnext.module \prevnext_node_presave()
 - 2.0.x prevnext.module \prevnext_node_presave()
 
Implements hook_ENTITY_TYPE_presave().
File
- ./
prevnext.module, line 118  - Contains prevnext.module.
 
Code
function prevnext_node_presave(Drupal\Core\Entity\EntityInterface $entity) {
  $config = \Drupal::config('prevnext.settings');
  $enabled_nodetypes = $config
    ->get('prevnext_enabled_nodetypes');
  if (in_array($entity
    ->bundle(), $enabled_nodetypes)) {
    // We are saving a node of a type with prevnext enabled, so invalidate
    // all cached rendered output of other nodes of this type with our tag.
    Cache::invalidateTags([
      'prevnext-' . $entity
        ->bundle(),
    ]);
  }
}