function AllowToolbarPath::check

Same name and namespace in other branches
  1. 9 core/modules/toolbar/src/PageCache/AllowToolbarPath.php \Drupal\toolbar\PageCache\AllowToolbarPath::check()
  2. 8.9.x core/modules/toolbar/src/PageCache/AllowToolbarPath.php \Drupal\toolbar\PageCache\AllowToolbarPath::check()
  3. 10 core/modules/toolbar/src/PageCache/AllowToolbarPath.php \Drupal\toolbar\PageCache\AllowToolbarPath::check()

Overrides RequestPolicyInterface::check

File

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

Class

AllowToolbarPath
Cache policy for the toolbar page cache service.

Namespace

Drupal\toolbar\PageCache

Code

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;
    }
}

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