You are here

public function ChainRequestPolicy::addPolicy in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/PageCache/ChainRequestPolicy.php \Drupal\Core\PageCache\ChainRequestPolicy::addPolicy()

Add a policy to the list of policy rules.

Parameters

\Drupal\Core\PageCache\RequestPolicyInterface $policy: The request policy rule to add.

Return value

$this

Overrides ChainRequestPolicyInterface::addPolicy

2 calls to ChainRequestPolicy::addPolicy()
DefaultRequestPolicy::__construct in core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php
Constructs the default page cache request policy.
DefaultRequestPolicy::__construct in core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php
Constructs the default Dynamic Page Cache request policy.

File

core/lib/Drupal/Core/PageCache/ChainRequestPolicy.php, line 55

Class

ChainRequestPolicy
Implements a compound request policy.

Namespace

Drupal\Core\PageCache

Code

public function addPolicy(RequestPolicyInterface $policy) {
  $this->rules[] = $policy;
  return $this;
}