function DefaultSelection::reAlterQuery
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::reAlterQuery()
- 10 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::reAlterQuery()
- 11.x core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::reAlterQuery()
Helper method: Passes a query to the alteration system again.
This allows Entity Reference to add a tag to an existing query so it can ask access control mechanisms to alter it again.
1 call to DefaultSelection::reAlterQuery()
- CommentSelection::entityQueryAlter in core/
modules/ comment/ src/ Plugin/ EntityReferenceSelection/ CommentSelection.php
File
-
core/
lib/ Drupal/ Core/ Entity/ Plugin/ EntityReferenceSelection/ DefaultSelection.php, line 484
Class
- DefaultSelection
- Default plugin implementation of the Entity Reference Selection plugin.
Namespace
Drupal\Core\Entity\Plugin\EntityReferenceSelectionCode
protected function reAlterQuery(AlterableInterface $query, $tag, $base_table) {
// Save the old tags and metadata.
// For some reason, those are public.
$old_tags = $query->alterTags;
$old_metadata = $query->alterMetaData;
$query->alterTags = [
$tag => TRUE,
];
$query->alterMetaData['base_table'] = $base_table;
$this->moduleHandler
->alter([
'query',
'query_' . $tag,
], $query);
// Restore the tags and metadata.
$query->alterTags = $old_tags;
$query->alterMetaData = $old_metadata;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.