You are here

class AllowToolbarPath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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
Contains \Drupal\Tests\toolbar\Unit\PageCache\AllowToolbarPathTest.
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 19
Contains \Drupal\toolbar\PageCache\AllowToolbarPath.

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

Namesort descending Modifiers Type Description Overrides
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.