class AllowToolbarPath

Same name in other branches
  1. 8.9.x core/modules/toolbar/src/PageCache/AllowToolbarPath.php \Drupal\toolbar\PageCache\AllowToolbarPath
  2. 10 core/modules/toolbar/src/PageCache/AllowToolbarPath.php \Drupal\toolbar\PageCache\AllowToolbarPath
  3. 11.x core/modules/toolbar/src/PageCache/AllowToolbarPath.php \Drupal\toolbar\PageCache\AllowToolbarPath

Cache policy for the toolbar page cache service.

This policy allows caching of requests directed to /toolbar/subtrees/{hash} even for authenticated users.

Hierarchy

Expanded class hierarchy of AllowToolbarPath

1 file declares its use of AllowToolbarPath
AllowToolbarPathTest.php in core/modules/toolbar/tests/src/Unit/PageCache/AllowToolbarPathTest.php
1 string reference to 'AllowToolbarPath'
toolbar.services.yml in core/modules/toolbar/toolbar.services.yml
core/modules/toolbar/toolbar.services.yml
1 service uses AllowToolbarPath
toolbar.page_cache_request_policy.allow_toolbar_path in core/modules/toolbar/toolbar.services.yml
Drupal\toolbar\PageCache\AllowToolbarPath

File

core/modules/toolbar/src/PageCache/AllowToolbarPath.php, line 14

Namespace

Drupal\toolbar\PageCache
View source
class AllowToolbarPath implements RequestPolicyInterface {
    
    /**
     * {@inheritdoc}
     */
    public function check(Request $request) {
        // Note that this regular expression matches the end of pathinfo in order to
        // support multilingual sites using path prefixes.
        if (preg_match('#/toolbar/subtrees/[^/]+(/[^/]+)?$#', $request->getPathInfo())) {
            return static::ALLOW;
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
AllowToolbarPath::check public function Determines whether delivery of a cached page should be attempted. Overrides RequestPolicyInterface::check
RequestPolicyInterface::ALLOW constant Allow delivery of cached pages.
RequestPolicyInterface::DENY constant Deny delivery of cached pages.

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