You are here

function views_natural_sort_remove in Views Natural Sort 8.2

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

Remove a views_natural_sort index entry based on keys.

@Not-Rewritten

Parameters

array $index_entry: Mirrors the views_natural_sort table $eid - Entity Id of the item referenced $entity_type - The Entity Type. Ex. node $field - (optional) reference to the property or field name $delta - (optional)the item number in that field or property If an optional parameter doesn't exist, this is treated as a wild card delete.

1 call to views_natural_sort_remove()
views_natural_sort_entity_delete in ./views_natural_sort.module
Implements hook_entity_delete().

File

./views_natural_sort.module, line 129
Contains views_natural_sort.module..

Code

function views_natural_sort_remove(array $index_entry) {
  $query = \Drupal::database()
    ->delete('views_natural_sort')
    ->condition('eid', $index_entry['eid'])
    ->condition('entity_type', $index_entry['entity_type']);
  if (isset($index_entry['field'])) {
    $query
      ->condition('field', $index_entry['field']);
  }
  if (isset($index_entry['delta'])) {
    $query
      ->condition('delta', $index_entry['delta']);
  }
  $query
    ->execute();
}