function 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 803

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');
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.