You are here

protected function ConnectionRoleSelection::buildEntityQuery in RedHen CRM 8

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/redhen_connection/src/Plugin/EntityReferenceSelection/ConnectionRoleSelection.php, line 23

Class

ConnectionRoleSelection
Limit connection roles to those associated with this connection_type.

Namespace

Drupal\redhen_connection\Plugin\EntityReferenceSelection

Code

protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
  $query = parent::buildEntityQuery($match, $match_operator);

  // If the handler specifies a connection type...
  if (isset($this->configuration['handler_settings']['connection_type'])) {
    $connection_type = $this->configuration['handler_settings']['connection_type'];

    // Add connection_type parameter to the query.
    $query
      ->condition('connection_type', $connection_type, '=');
  }
  return $query;
}