function BlockContentSelection::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

core/modules/block_content/src/Plugin/EntityReferenceSelection/BlockContentSelection.php, line 27

Class

BlockContentSelection
Provides specific selection control for the block_content entity type.

Namespace

Drupal\block_content\Plugin\EntityReferenceSelection

Code

protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
  $query = parent::buildEntityQuery($match, $match_operator);
  // Only reusable blocks should be able to be referenced.
  $query->condition('reusable', TRUE);
  return $query;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.