protected function CommentSelection::buildEntityQuery in Drupal 10
Same name and namespace in other branches
- 8 core/modules/comment/src/Plugin/EntityReferenceSelection/CommentSelection.php \Drupal\comment\Plugin\EntityReferenceSelection\CommentSelection::buildEntityQuery()
- 9 core/modules/comment/src/Plugin/EntityReferenceSelection/CommentSelection.php \Drupal\comment\Plugin\EntityReferenceSelection\CommentSelection::buildEntityQuery()
File
- core/
modules/ comment/ src/ Plugin/ EntityReferenceSelection/ CommentSelection.php, line 26
Class
- CommentSelection
- Provides specific access control for the comment entity type.
Namespace
Drupal\comment\Plugin\EntityReferenceSelectionCode
protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = parent::buildEntityQuery($match, $match_operator);
// Adding the 'comment_access' tag is sadly insufficient for comments:
// core requires us to also know about the concept of 'published' and
// 'unpublished'.
if (!$this->currentUser
->hasPermission('administer comments')) {
$query
->condition('status', CommentInterface::PUBLISHED);
}
return $query;
}