Mercurial > hg > isophonics-drupal-site
comparison core/modules/toolbar/src/PageCache/AllowToolbarPath.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\toolbar\PageCache; | |
4 | |
5 use Drupal\Core\PageCache\RequestPolicyInterface; | |
6 use Symfony\Component\HttpFoundation\Request; | |
7 | |
8 /** | |
9 * Cache policy for the toolbar page cache service. | |
10 * | |
11 * This policy allows caching of requests directed to /toolbar/subtrees/{hash} | |
12 * even for authenticated users. | |
13 */ | |
14 class AllowToolbarPath implements RequestPolicyInterface { | |
15 | |
16 /** | |
17 * {@inheritdoc} | |
18 */ | |
19 public function check(Request $request) { | |
20 // Note that this regular expression matches the end of pathinfo in order to | |
21 // support multilingual sites using path prefixes. | |
22 if (preg_match('#/toolbar/subtrees/[^/]+(/[^/]+)?$#', $request->getPathInfo())) { | |
23 return static::ALLOW; | |
24 } | |
25 } | |
26 | |
27 } |