protected function RegistrationGroupSelection::buildEntityQuery in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Plugin/EntityReferenceSelection/RegistrationGroupSelection.php \Drupal\rng\Plugin\EntityReferenceSelection\RegistrationGroupSelection::buildEntityQuery()
- 3.x src/Plugin/EntityReferenceSelection/RegistrationGroupSelection.php \Drupal\rng\Plugin\EntityReferenceSelection\RegistrationGroupSelection::buildEntityQuery()
Builds an EntityQuery to get referenceable entities.
Parameters
string|null $match: (Optional) Text to match the label against. Defaults to NULL.
string $match_operator: (Optional) The operation the matching should be done with. Defaults to "CONTAINS".
Return value
\Drupal\Core\Entity\Query\QueryInterface The EntityQuery object with the basic conditions and sorting applied to it.
Overrides DefaultSelection::buildEntityQuery
File
- src/
Plugin/ EntityReferenceSelection/ RegistrationGroupSelection.php, line 25
Class
- RegistrationGroupSelection
- Provides specific access control for registration groups.
Namespace
Drupal\rng\Plugin\EntityReferenceSelectionCode
protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = parent::buildEntityQuery($match, $match_operator);
if (($event = $this->configuration['entity']) instanceof EntityInterface) {
$group = $query
->andConditionGroup()
->condition('event__target_type', $event
->getEntityTypeId(), '=')
->condition('event__target_id', $event
->id(), '=');
$query
->condition($group);
$query
->condition('source', NULL, 'IS NULL');
}
return $query;
}