You are here

public function SearchApiMultiRowEntityView::init in Search API Multi-Index Searches 7

Overrides views_plugin_row::init

File

views/row_entity_view.inc, line 32
Contains the SearchApiMultiRowEntityView class.

Class

SearchApiMultiRowEntityView
Plugin class for displaying Views results with entity_view.

Code

public function init(&$view, &$display, $options = NULL) {
  parent::init($view, $display, $options);

  // Initialize the query, which will provides us with an access to the
  // indexes used by this view, and thus to the entity types.
  if (is_null($this->view->query)) {
    $this->view
      ->init_query();
  }
  $entity_types = $incompatibles = array();
  foreach ($this->view->query
    ->getIndexes() as $id => $index) {
    $type = $index
      ->getEntityType();
    $label = $index
      ->label();
    if ($type) {
      $entity_types[$type][] = $label;
    }
    else {
      $incompatibles[$id] = $label;
    }
  }
  $this->indexes = array(
    'entity_types' => $entity_types,
    'incompatibles' => $incompatibles,
  );
}