You are here

public function EntityFieldQuery::init in EntityFieldQuery Views Backend 8

Initialize the plugin.

Parameters

\Drupal\views\ViewExecutable $view: The view object.

\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.

array $options: The options configured for this plugin.

Overrides PluginBase::init

File

src/Plugin/views/query/EntityFieldQuery.php, line 61

Class

EntityFieldQuery
Views query plugin for an SQL query.

Namespace

Drupal\efq_views\Plugin\views\query

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);
  $this->query = $this->entityTypeManager
    ->getStorage($this
    ->getEntityTypeId())
    ->getQuery();
  $this->tables = array();

  // An entity type (such as EntityFieldQuery: Node) was selected.
  // We have entity type passed in as base table, prefixed with 'efq_'
  $entity_type = preg_replace('/^efq_/', '', $base_table);
  $this->entity_type = $entity_type;
  $this->query
    ->entityCondition('entity_type', $entity_type);
}