You are here

public function SearchApiRow::init in Search API 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/row/SearchApiRow.php, line 85

Class

SearchApiRow
Provides a row plugin for displaying a result as a rendered item.

Namespace

Drupal\search_api\Plugin\views\row

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);
  $base_table = $view->storage
    ->get('base_table');
  $this->index = SearchApiQuery::getIndexFromTable($base_table, $this
    ->getEntityTypeManager());
  if (!$this->index) {
    $view_label = $view->storage
      ->label();
    throw new \InvalidArgumentException("View '{$view_label}' is not based on Search API but tries to use its row plugin.");
  }
}