function views_natural_sort_views_natural_sort_queue_rebuild_data in Views Natural Sort 8.2
Same name and namespace in other branches
- 7.2 views_natural_sort.module \views_natural_sort_views_natural_sort_queue_rebuild_data()
Implements hook_views_natural_sort_queue_rebuild_data().
File
- ./
views_natural_sort.module, line 59 - Contains views_natural_sort.module..
Code
function views_natural_sort_views_natural_sort_queue_rebuild_data(IndexRecordType $entry_type) {
$service = Drupal::service('views_natural_sort.service');
$supported_entity_properties = $service
->getViewsSupportedEntityProperties();
$entity_type = $entry_type
->getEntityType();
$field = $entry_type
->getField();
if (empty($supported_entity_properties[$entity_type]) || empty($supported_entity_properties[$entity_type][$field])) {
return;
}
$queue = Drupal::queue('views_natural_sort_entity_index');
$query = Drupal::entityQuery($entity_type);
$entity_ids = $query
->execute();
foreach ($entity_ids as $entity_id) {
$queue
->createItem([
'entity_type' => $entity_type,
'entity_id' => $entity_id,
]);
}
return 'views_natural_sort_entity_index';
}