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

Breadcrumb

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

function DisplayPluginBase::calculateCacheMetadata

Overrides DisplayPluginInterface::calculateCacheMetadata

1 call to DisplayPluginBase::calculateCacheMetadata()
DisplayPluginBase::getCacheMetadata in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Gets the cache metadata.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2367

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public function calculateCacheMetadata() {
    $cache_metadata = new CacheableMetadata();
    // Iterate over ordinary views plugins.
    foreach (Views::getPluginTypes('plugin') as $plugin_type) {
        $plugin = $this->getPlugin($plugin_type);
        if ($plugin instanceof CacheableDependencyInterface) {
            $cache_metadata = $cache_metadata->merge(CacheableMetadata::createFromObject($plugin));
        }
    }
    // Iterate over all handlers. Note that at least the argument handler will
    // need to ask all its subplugins.
    foreach (array_keys(Views::getHandlerTypes()) as $handler_type) {
        $handlers = $this->getHandlers($handler_type);
        foreach ($handlers as $handler) {
            if ($handler instanceof CacheableDependencyInterface) {
                $cache_metadata = $cache_metadata->merge(CacheableMetadata::createFromObject($handler));
            }
        }
    }
    
    /** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
    if ($cache_plugin = $this->getPlugin('cache')) {
        $cache_plugin->alterCacheMetadata($cache_metadata);
    }
    return $cache_metadata;
}

API Navigation

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