public function QueryAccessHandlerBase::getConditions in Group 8
Same name and namespace in other branches
- 2.0.x src/Entity/Access/QueryAccessHandlerBase.php \Drupal\group\Entity\Access\QueryAccessHandlerBase::getConditions()
Gets the conditions for the given operation and user.
The "entity.query_access.$entity_type_id" event is fired to allow modules to alter the conditions.
Parameters
string $operation: The access operation. Usually one of "view", "update", "duplicate", or "delete".
\Drupal\Core\Session\AccountInterface $account: The user for which to restrict access, or NULL to assume the current user. Defaults to NULL.
Return value
\Drupal\entity\QueryAccess\ConditionGroup The conditions.
Overrides QueryAccessHandlerInterface::getConditions
File
- src/
Entity/ Access/ QueryAccessHandlerBase.php, line 83
Class
- QueryAccessHandlerBase
- Controls query access for the Group module's entities.
Namespace
Drupal\group\Entity\AccessCode
public function getConditions($operation, AccountInterface $account = NULL) {
$account = $account ?: $this->currentUser;
$entity_type_id = $this->entityType
->id();
$conditions = $this
->buildConditions($operation, $account);
// Allow other modules to modify the conditions before they are used.
$event = new QueryAccessEvent($conditions, $operation, $account, $entity_type_id);
$this->eventDispatcher
->dispatch("entity.query_access", $event);
$this->eventDispatcher
->dispatch("entity.query_access.{$entity_type_id}", $event);
return $conditions;
}