You are here

protected function RenderCacheBackendAdapter::preserveProperties in Render cache 7.2

Preserves some properties based on the cache info struct.

Parameters

array $render: The render array to preserve properties for.

array $cache_info: The cache information structure.

Return value

array The preserved properties.

1 call to RenderCacheBackendAdapter::preserveProperties()
RenderCacheBackendAdapter::set in src/Cache/RenderCacheBackendAdapter.php
Sets one cache entry based on the given $cache_info structure.

File

src/Cache/RenderCacheBackendAdapter.php, line 239
Contains \Drupal\render_cache\Cache\RenderCacheBackendAdapter

Class

RenderCacheBackendAdapter
Defines the render_cache.cache service.

Namespace

Drupal\render_cache\Cache

Code

protected function preserveProperties(array $render, array $cache_info) {
  $properties = array();
  if (empty($cache_info['render_cache_preserve_properties']) || !is_array($cache_info['render_cache_preserve_properties'])) {
    return $properties;
  }
  foreach ($cache_info['render_cache_preserve_properties'] as $key) {
    if (isset($render[$key])) {
      $properties[$key] = $render[$key];
    }
  }
  return $properties;
}