Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CachePluginBase.php

function 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 288

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal