You are here

function lightning_api_entity_insert in Lightning API 8.4

Same name and namespace in other branches
  1. 8 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 17
Contains hook implementations for Lightning API.

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')
      ->rebuild();
    Drupal::service('router.route_provider')
      ->reset();
  }
}