You are here

function views_natural_sort_entity_insert in Views Natural Sort 7.2

Same name and namespace in other branches
  1. 8.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 164
Views Natural Sort module.

Code

function views_natural_sort_entity_insert($entity, $type) {
  $supported_entity_types = views_natural_sort_get_entry_types();
  foreach ($supported_entity_types as $key => $entry_type) {
    if ($entry_type['entity_type'] == $type && $entry_type['module'] == 'views_natural_sort' && isset($entity->{$entry_type['field']})) {
      views_natural_sort_store(views_natural_sort_entity_to_vns($entity, $type, $entry_type['field']));
    }
  }
}