ViewExecutable::addCacheContext

public ViewExecutable::addCacheContext($cache_context)

Expands the list of used cache contexts for the view.

Parameters

string $cache_context: The additional cache context.

Return value

$this

File

core/modules/views/src/ViewExecutable.php, line 497

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

1
2
3
4
5
public function addCacheContext($cache_context) {
  $this->element['#cache']['contexts'][] = $cache_context;
 
  return $this;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.