Commit 04c15c0e authored by generalredneck's avatar generalredneck

Refactoring the entity Insert and Update hook to use the new service.

parent c5958d75
......@@ -92,15 +92,10 @@ function views_natural_sort_views_natural_sort_get_rebuild_data($entry_type){
* This keeps our natural sort index up to date.
*/
function views_natural_sort_entity_insert(EntityInterface $entity) {
$supported_entity_properties = views_natural_sort_get_views_configurable_properties();
if (empty($supported_entity_properties[$entity->getEntityTypeId()])) {
return;
}
foreach ($supported_entity_properties[$entity->getEntityTypeId()] as $property => $property_info) {
// Proposed by hgoto in #2672538. Made it in before he got credit.
if (isset($entity->{$property})) {
views_natural_sort_store_multiple(views_natural_sort_entity_to_vns($entity, $property));
}
$service = Drupal::service('views_natural_sort.service');
$supported_entity_properties = $service->getSupportedEntityProperties();
if (isset($supported_entity_properties[$entity->getEntityTypeId()])) {
$service->storeIndexRecordsFromEntity($entity);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment