function entity_query_entity_query_alter in Entity API 8
Implements hook_query_TAG_alter().
File
- ./
entity.module, line 147 - Provides expanded entity APIs.
Code
function entity_query_entity_query_alter(SelectInterface $query) {
$entity_type_id = $query
->getMetaData('entity_type');
if ($query
->hasTag($entity_type_id . '_access')) {
$entity_type_manager = \Drupal::entityTypeManager();
$entity_type = $entity_type_manager
->getDefinition($entity_type_id);
\Drupal::service('class_resolver')
->getInstanceFromDefinition(EntityQueryAlter::class)
->alter($query, $entity_type);
}
}