You are here

public function SearchApiFieldTrait::preRender in Search API 8

Runs before any fields are rendered.

This gives the handlers some time to set up before any handler has been rendered.

Parameters

\Drupal\views\ResultRow[]|\ArrayAccess $values: An array of all ResultRow objects returned from the query.

See also

\Drupal\views\Plugin\views\field\FieldHandlerInterface::preRender()

3 calls to SearchApiFieldTrait::preRender()
SearchApiBulkForm::preRender in src/Plugin/views/field/SearchApiBulkForm.php
Runs before any fields are rendered.
SearchApiEntity::preRender in src/Plugin/views/field/SearchApiEntity.php
Runs before any fields are rendered.
SearchApiEntityField::preRender in src/Plugin/views/field/SearchApiEntityField.php
Runs before any fields are rendered.
1 method overrides SearchApiFieldTrait::preRender()
SearchApiEntity::preRender in src/Plugin/views/field/SearchApiEntity.php
Runs before any fields are rendered.

File

src/Plugin/views/field/SearchApiFieldTrait.php, line 452

Class

SearchApiFieldTrait
Provides a trait to use for Search API Views field handlers.

Namespace

Drupal\search_api\Plugin\views\field

Code

public function preRender(&$values) {

  // We deal with the properties one by one, always loading the necessary
  // values for any nested properties coming afterwards.
  foreach ($this
    ->expandRequiredProperties() as $datasource_id => $properties) {
    $datasource_id = $datasource_id ?: NULL;
    foreach ($properties as $property_path => $info) {
      $combined_property_path = $info['combined_property_path'];
      $dependents = $info['dependents'];
      if ($combined_property_path === NULL) {
        $this
          ->preLoadResultItems($values, $dependents);
        continue;
      }
      $property_values = $this
        ->getValuesToExtract($values, $datasource_id, $property_path, $combined_property_path, $dependents);
      $this
        ->extractPropertyValues($values, $combined_property_path, $property_values, $dependents);
      $this
        ->checkHighlighting($values, $datasource_id, $property_path, $combined_property_path);
    }
  }
}