Alter an entity query that has a specific tag.

Parameters

\Drupal\Core\Entity\Query\QueryInterface $query: The entity query.

See also

hook_entity_query_alter()

hook_entity_query_tag__ENTITY_TYPE__TAG_alter()

\Drupal\Core\Entity\Query\QueryInterface

Related topics

3 functions implement hook_entity_query_tag__TAG_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

config_test_entity_query_tag__config_query_test__config_entity_query_alter_hook_test_alter in core/modules/config/tests/config_test/config_test.module
Implements hook_entity_query_tag__ENTITY_TYPE__TAG_alter().
field_test_entity_query_tag__entity_query_alter_tag_test_alter in core/modules/field/tests/modules/field_test/field_test.module
Implements hook_entity_query_tag__TAG_alter() for 'entity_query_alter_tag_test'.
field_test_entity_query_tag__entity_test_mulrev__entity_query_entity_test_mulrev_alter_tag_test_alter in core/modules/field/tests/modules/field_test/field_test.module
Implements hook_entity_query_tag__ENTITY_TYPE__TAG_alter().

File

core/lib/Drupal/Core/Entity/entity.api.php, line 2349
Hooks and documentation related to entities.

Code

function hook_entity_query_tag__TAG_alter(\Drupal\Core\Entity\Query\QueryInterface $query) : void {
  $entityType = \Drupal::entityTypeManager()
    ->getDefinition($query
    ->getEntityTypeId());
  $query
    ->sort($entityType
    ->getKey('id'), 'desc');
}