Same name and namespace in other branches
- 8.9.x core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_query_entity_test_access_alter()
- 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_query_entity_test_access_alter()
Implements hook_query_entity_test_access_alter().
File
- core/
modules/ system/ tests/ modules/ entity_test/ entity_test.module, line 812 - Test module for the entity API providing several entity types for testing.
Code
function entity_test_query_entity_test_access_alter(AlterableInterface $query) {
if (!\Drupal::state()
->get('entity_test_query_access')) {
return;
}
/** @var \Drupal\Core\Database\Query\Select|\Drupal\Core\Database\Query\AlterableInterface $query */
if (!\Drupal::currentUser()
->hasPermission('view all entity_test_query_access entities')) {
$query
->condition('entity_test_query_access.name', 'published entity');
}
}