You are here

protected function DisplayPluginBase::applyDisplayCachablityMetadata in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::applyDisplayCachablityMetadata()

Applies the cacheability of the current display to the given render array.

Parameters

array $element: The render array with updated cacheability metadata.

4 calls to DisplayPluginBase::applyDisplayCachablityMetadata()
DisplayPluginBase::buildRenderable in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Builds a renderable array of the view.
DisplayPluginBase::render in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Renders this display.
Feed::render in core/modules/views/src/Plugin/views/display/Feed.php
Renders this display.
RestExport::render in core/modules/rest/src/Plugin/views/display/RestExport.php
Renders this display.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2144
Contains \Drupal\views\Plugin\views\display\DisplayPluginBase.

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

protected function applyDisplayCachablityMetadata(array &$element) {

  /** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
  $cache = $this
    ->getPlugin('cache');
  (new CacheableMetadata())
    ->setCacheTags(Cache::mergeTags($this->view
    ->getCacheTags(), isset($this->display['cache_metadata']['tags']) ? $this->display['cache_metadata']['tags'] : []))
    ->setCacheContexts(isset($this->display['cache_metadata']['contexts']) ? $this->display['cache_metadata']['contexts'] : [])
    ->setCacheMaxAge(Cache::mergeMaxAges($cache
    ->getCacheMaxAge(), isset($this->display['cache_metadata']['max-age']) ? $this->display['cache_metadata']['max-age'] : Cache::PERMANENT))
    ->merge(CacheableMetadata::createFromRenderArray($element))
    ->applyTo($element);
}