You are here

function prev_next_entity_insert in Previous/Next API 8.2

Implements hook_entity_insert().

File

./prev_next.module, line 48
Contains prev_next.module.

Code

function prev_next_entity_insert(EntityInterface $entity) {
  $bundle_names = \Drupal::service('prev_next.helper')
    ->getBundleNames();
  if ($entity instanceof NodeInterface && in_array($entity
    ->getType(), $bundle_names)) {
    \Drupal::service('prev_next.api')
      ->add($entity
      ->id(), $entity
      ->getType());
  }
}