You are here

protected function CachePluginBase::prepareViewResult in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/cache/CachePluginBase.php \Drupal\views\Plugin\views\cache\CachePluginBase::prepareViewResult()

Prepares the view result before putting it into cache.

Parameters

\Drupal\views\ResultRow[] $result: The result containing loaded entities.

Return value

\Drupal\views\ResultRow[] $result The result without loaded entities.

1 call to CachePluginBase::prepareViewResult()
CachePluginBase::cacheSet in core/modules/views/src/Plugin/views/cache/CachePluginBase.php
Save data to the cache.

File

core/modules/views/src/Plugin/views/cache/CachePluginBase.php, line 274
Contains \Drupal\views\Plugin\views\cache\CachePluginBase.

Class

CachePluginBase
The base plugin to handle caching.

Namespace

Drupal\views\Plugin\views\cache

Code

protected function prepareViewResult(array $result) {
  $return = [];

  // Clone each row object and remove any loaded entities, to keep the
  // original result rows intact.
  foreach ($result as $key => $row) {
    $clone = clone $row;
    $clone
      ->resetEntityData();
    $return[$key] = $clone;
  }
  return $return;
}