function CachePluginBase::prepareViewResult
Same name in other branches
- 8.9.x core/modules/views/src/Plugin/views/cache/CachePluginBase.php \Drupal\views\Plugin\views\cache\CachePluginBase::prepareViewResult()
- 10 core/modules/views/src/Plugin/views/cache/CachePluginBase.php \Drupal\views\Plugin\views\cache\CachePluginBase::prepareViewResult()
- 11.x 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[] 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 283
Class
- CachePluginBase
- The base plugin to handle caching.
Namespace
Drupal\views\Plugin\views\cacheCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.