You are here

protected function ContributorSelection::buildEntityQuery in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 modules/bibcite_entity/src/Plugin/EntityReferenceSelection/ContributorSelection.php \Drupal\bibcite_entity\Plugin\EntityReferenceSelection\ContributorSelection::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

modules/bibcite_entity/src/Plugin/EntityReferenceSelection/ContributorSelection.php, line 33

Class

ContributorSelection
Provides specific access control for the contributor entity type.

Namespace

Drupal\bibcite_entity\Plugin\EntityReferenceSelection

Code

protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
  $query = parent::buildEntityQuery($match, $match_operator);
  $group = $query
    ->orConditionGroup();
  foreach (Contributor::getNameParts() as $part) {
    $group
      ->condition($part, $match, $match_operator);
  }
  $query
    ->condition($group);
  return $query;
}