You are here

public function SearchApiDataRow::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/SearchApiDataRow.php, line 43

Class

SearchApiDataRow
Displays entities as raw data.

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.");
  }
}