You are here

function views_natural_sort_entity_insert in Views Natural Sort 8.2

Same name and namespace in other branches
  1. 7.2 views_natural_sort.module \views_natural_sort_entity_insert()

Implements hook_entity_insert().

This keeps our natural sort index up to date.

1 call to views_natural_sort_entity_insert()
views_natural_sort_entity_update in ./views_natural_sort.module
Implements hook_entity_update().

File

./views_natural_sort.module, line 86
Contains views_natural_sort.module..

Code

function views_natural_sort_entity_insert(EntityInterface $entity) {
  $service = Drupal::service('views_natural_sort.service');
  $supported_entity_properties = $service
    ->getViewsSupportedEntityProperties();
  if (isset($supported_entity_properties[$entity
    ->getEntityTypeId()])) {
    $service
      ->storeIndexRecordsFromEntity($entity);
  }
}