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

Breadcrumb

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

function DisplayPluginBase::applyDisplayCacheabilityMetadata

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

Parameters

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

5 calls to DisplayPluginBase::applyDisplayCacheabilityMetadata()
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.
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 2236

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

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

API Navigation

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