You are here

public function SearchApiDataRow::preRender in Search API 8

Allow the style to do stuff before each row is rendered.

Parameters

$result: The full array of results from the query.

Overrides RowPluginBase::preRender

File

src/Plugin/views/row/SearchApiDataRow.php, line 57

Class

SearchApiDataRow
Displays entities as raw data.

Namespace

Drupal\search_api\Plugin\views\row

Code

public function preRender($result) {
  parent::preRender($result);
  $this
    ->getQuery()
    ->getSearchApiResults()
    ->preLoadResultItems();

  /** @var \Drupal\search_api\Plugin\views\ResultRow $row */
  foreach ($result as $row) {
    if (!$row->_object) {
      try {
        $row->_object = $row->_item
          ->getOriginalObject(FALSE);
      } catch (SearchApiException $e) {

        // Can never happen for getOriginalObject() with $load = FALSE. Catch
        // for sake of static analysis.
      }
    }
  }
}