/** * {@inheritdoc} */ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { try { parent::init($view, $display, $options); $this->index = static::getIndexFromTable($view->storage->get('base_table')); if (!$this->index) { $this->abort(new FormattableMarkup('View %view is not based on Search API but tries to use its query plugin.', array('%view' => $view->storage->label()))); } $this->retrievedProperties = array_fill_keys($this->index->getDatasourceIds(), array()); $this->retrievedProperties[NULL] = array(); $this->query = $this->index->query(); $this->query->setParseMode($this->options['parse_mode']); $this->query->addTag('views'); $this->query->addTag('views_' . $view->id()); $this->query->setOption('search_api_view', $view); } catch (\Exception $e) { $this->abort($e->getMessage()); } }