You are here

function lightning_api_entity_insert in Lightning API 8

Same name and namespace in other branches
  1. 8.4 lightning_api.module \lightning_api_entity_insert()
  2. 8.2 lightning_api.module \lightning_api_entity_insert()
  3. 8.3 lightning_api.module \lightning_api_entity_insert()

Implements hook_entity_insert().

File

./lightning_api.module, line 29

Code

function lightning_api_entity_insert(EntityInterface $entity) {
  $allowed = \Drupal::config('lightning_api.settings')
    ->get('entity_json');
  if ($entity
    ->getEntityType()
    ->getBundleOf() && $allowed) {
    \Drupal::service('router.builder')
      ->setRebuildNeeded();
  }
}