function hook_entity_query_tag__TAG_alter
Alter an entity query that has a specific tag.
Parameters
\Drupal\Core\Entity\Query\QueryInterface $query: The entity query.
See also
hook_entity_query_tag__ENTITY_TYPE__TAG_alter()
\Drupal\Core\Entity\Query\QueryInterface
Related topics
File
-
core/
lib/ Drupal/ Core/ Entity/ entity.api.php, line 2386
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');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.