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

Breadcrumb

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

function ArgumentPluginBase::getCacheContexts

Overrides CacheableDependencyInterface::getCacheContexts

File

core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php, line 1330

Class

ArgumentPluginBase
Base class for argument (contextual filter) handler plugins.

Namespace

Drupal\views\Plugin\views\argument

Code

public function getCacheContexts() {
    $contexts = [];
    // By definition arguments depends on the URL.
    // @todo Once contexts are properly injected into block views we could pull
    //   the information from there.
    $contexts[] = 'url';
    // Asks all subplugins (argument defaults, argument validator and styles).
    if (($plugin = $this->getPlugin('argument_default')) && $plugin instanceof CacheableDependencyInterface) {
        $contexts = Cache::mergeContexts($contexts, $plugin->getCacheContexts());
    }
    if (($plugin = $this->getPlugin('argument_validator')) && $plugin instanceof CacheableDependencyInterface) {
        $contexts = Cache::mergeContexts($contexts, $plugin->getCacheContexts());
    }
    if (($plugin = $this->getPlugin('style')) && $plugin instanceof CacheableDependencyInterface) {
        $contexts = Cache::mergeContexts($contexts, $plugin->getCacheContexts());
    }
    return $contexts;
}
RSS feed
Powered by Drupal