function Table::getCacheContexts

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/style/Table.php \Drupal\views\Plugin\views\style\Table::getCacheContexts()
  2. 8.9.x core/modules/views/src/Plugin/views/style/Table.php \Drupal\views\Plugin\views\style\Table::getCacheContexts()
  3. 10 core/modules/views/src/Plugin/views/style/Table.php \Drupal\views\Plugin\views\style\Table::getCacheContexts()

Overrides CacheableDependencyInterface::getCacheContexts

File

core/modules/views/src/Plugin/views/style/Table.php, line 436

Class

Table
Style plugin to render each item as a row in a table.

Namespace

Drupal\views\Plugin\views\style

Code

public function getCacheContexts() {
    $contexts = [];
    foreach ($this->options['info'] as $info) {
        if (!empty($info['sortable'])) {
            // The rendered link needs to play well with any other query parameter
            // used on the page, like pager and exposed filter.
            $contexts[] = 'url.query_args';
            break;
        }
    }
    return $contexts;
}

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