function EntityTestHooks::queryEntityTestAccessAlter
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php \Drupal\entity_test\Hook\EntityTestHooks::queryEntityTestAccessAlter()
Implements hook_query_entity_test_access_alter().
Attributes
#[Hook('query_entity_test_access_alter')]
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Hook/ EntityTestHooks.php, line 722
Class
- EntityTestHooks
- Hook implementations for entity_test.
Namespace
Drupal\entity_test\HookCode
public function queryEntityTestAccessAlter(AlterableInterface $query) : void {
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');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.