You are here

protected function StateSelection::buildEntityQuery in Booking and Availability Management Tools for Drupal 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/bat_event/src/Plugin/EntityReferenceSelection/StateSelection.php, line 24

Class

StateSelection
Entity reference selection.

Namespace

Drupal\bat_event\Plugin\EntityReferenceSelection

Code

protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
  $config = $this->configuration;
  $query = parent::buildEntityQuery($match, $match_operator);

  // Limit states to those associated with the current bundle.
  if ($event_type_bundle = $config['handler_settings']['event_type_bundle']) {
    $query
      ->condition('event_type', $event_type_bundle, '=');
  }
  return $query;
}