function Current::getCacheContexts

Same name in other branches
  1. 8.9.x core/modules/user/src/Plugin/views/filter/Current.php \Drupal\user\Plugin\views\filter\Current::getCacheContexts()
  2. 10 core/modules/user/src/Plugin/views/filter/Current.php \Drupal\user\Plugin\views\filter\Current::getCacheContexts()
  3. 11.x core/modules/user/src/Plugin/views/filter/Current.php \Drupal\user\Plugin\views\filter\Current::getCacheContexts()

Overrides FilterPluginBase::getCacheContexts

File

core/modules/user/src/Plugin/views/filter/Current.php, line 48

Class

Current
Filter handler for the current user.

Namespace

Drupal\user\Plugin\views\filter

Code

public function getCacheContexts() {
    $contexts = parent::getCacheContexts();
    // This filter depends on the current user.
    $contexts[] = 'user';
    return $contexts;
}

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