function FilterPluginBase::getCacheContexts

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::getCacheContexts()
  2. 8.9.x core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::getCacheContexts()
  3. 11.x core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::getCacheContexts()

Overrides CacheableDependencyInterface::getCacheContexts

6 calls to FilterPluginBase::getCacheContexts()
Access::getCacheContexts in core/modules/node/src/Plugin/views/filter/Access.php
The cache contexts associated with this object.
Current::getCacheContexts in core/modules/user/src/Plugin/views/filter/Current.php
The cache contexts associated with this object.
ModerationStateFilter::getCacheContexts in core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php
The cache contexts associated with this object.
Status::getCacheContexts in core/modules/media/src/Plugin/views/filter/Status.php
The cache contexts associated with this object.
Status::getCacheContexts in core/modules/node/src/Plugin/views/filter/Status.php
The cache contexts associated with this object.

... See full list

6 methods override FilterPluginBase::getCacheContexts()
Access::getCacheContexts in core/modules/node/src/Plugin/views/filter/Access.php
The cache contexts associated with this object.
Current::getCacheContexts in core/modules/user/src/Plugin/views/filter/Current.php
The cache contexts associated with this object.
ModerationStateFilter::getCacheContexts in core/modules/content_moderation/src/Plugin/views/filter/ModerationStateFilter.php
The cache contexts associated with this object.
Status::getCacheContexts in core/modules/media/src/Plugin/views/filter/Status.php
The cache contexts associated with this object.
Status::getCacheContexts in core/modules/node/src/Plugin/views/filter/Status.php
The cache contexts associated with this object.

... See full list

File

core/modules/views/src/Plugin/views/filter/FilterPluginBase.php, line 1639

Class

FilterPluginBase
Base class for Views filters handler plugins.

Namespace

Drupal\views\Plugin\views\filter

Code

public function getCacheContexts() {
    $cache_contexts = [];
    // An exposed filter allows the user to change a view's filters. They accept
    // input from GET parameters, which are part of the URL. Hence a view with
    // an exposed filter is cacheable per URL.
    if ($this->isExposed()) {
        $cache_contexts[] = 'url';
    }
    return $cache_contexts;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.