protected function UserSelection::buildEntityQuery in Open Social 10.1.x
Same name in this branch
- 10.1.x modules/social_features/social_private_message/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_private_message\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 10.1.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
Same name and namespace in other branches
- 8.9 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 8.2 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 8.3 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 8.4 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 8.5 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 8.6 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 8.7 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 8.8 modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 10.3.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 10.0.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::buildEntityQuery()
- 10.2.x modules/social_features/social_profile/src/Plugin/EntityReferenceSelection/UserSelection.php \Drupal\social_profile\Plugin\EntityReferenceSelection\UserSelection::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".
array $ids: (Optional) $ids that are coming from an earlier request.
Return value
\Drupal\Core\Entity\Query\QueryInterface The EntityQuery object with the basic conditions and sorting applied to it.
Overrides UserSelection::buildEntityQuery
2 calls to UserSelection::buildEntityQuery()
- UserSelection::buildEntityQuery in modules/
social_features/ social_private_message/ src/ Plugin/ EntityReferenceSelection/ UserSelection.php - Builds an EntityQuery to get referenceable entities.
- UserSelection::validateReferenceableEntities in modules/
social_features/ social_profile/ src/ Plugin/ EntityReferenceSelection/ UserSelection.php - Validates which existing entities can be referenced.
1 method overrides UserSelection::buildEntityQuery()
- UserSelection::buildEntityQuery in modules/
social_features/ social_private_message/ src/ Plugin/ EntityReferenceSelection/ UserSelection.php - Builds an EntityQuery to get referenceable entities.
File
- modules/
social_features/ social_profile/ src/ Plugin/ EntityReferenceSelection/ UserSelection.php, line 64
Class
- UserSelection
- Provides specific access control for the user entity type.
Namespace
Drupal\social_profile\Plugin\EntityReferenceSelectionCode
protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS', array $ids = []) {
// If an earlier request already had the ids don't query them again.
if (empty($ids)) {
$config_factory = \Drupal::service('config.factory');
$config = $config_factory
->get('mentions.settings');
$suggestion_format = $config
->get('suggestions_format');
$suggestion_amount = $config
->get('suggestions_amount');
$ids = $this
->getUserIdsFromName($match, $suggestion_amount, $suggestion_format);
}
// Add the ability to search users also by mail.
if (empty($ids) && $this->currentUser
->hasPermission('view profile email')) {
$query = parent::buildEntityQuery(NULL, $match_operator);
$query
->condition('mail', $match, $match_operator);
$ids = $query
->execute();
}
if (empty($ids)) {
return parent::buildEntityQuery($match, $match_operator);
}
$query = parent::buildEntityQuery(NULL, $match_operator);
$query
->condition('uid', $ids, 'IN');
return $query;
}