Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Routing/UrlMatcher.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\Core\Routing; | |
4 | |
5 use Drupal\Core\Path\CurrentPathStack; | |
6 use Symfony\Component\HttpFoundation\Request; | |
7 use Symfony\Component\Routing\RouteCollection; | |
8 use Symfony\Cmf\Component\Routing\NestedMatcher\UrlMatcher as BaseUrlMatcher; | |
9 | |
10 /** | |
11 * Drupal-specific URL Matcher; handles the Drupal "system path" mapping. | |
12 */ | |
13 class UrlMatcher extends BaseUrlMatcher { | |
14 | |
15 /** | |
16 * The current path. | |
17 * | |
18 * @var \Drupal\Core\Path\CurrentPathStack | |
19 */ | |
20 protected $currentPath; | |
21 | |
22 /** | |
23 * Constructs a new UrlMatcher. | |
24 * | |
25 * The parent class has a constructor we need to skip, so just override it | |
26 * with a no-op. | |
27 * | |
28 * @param \Drupal\Core\Path\CurrentPathStack $current_path | |
29 * The current path. | |
30 */ | |
31 public function __construct(CurrentPathStack $current_path) { | |
32 $this->currentPath = $current_path; | |
33 } | |
34 | |
35 public function finalMatch(RouteCollection $collection, Request $request) { | |
36 $this->routes = $collection; | |
37 $context = new RequestContext(); | |
38 $context->fromRequest($request); | |
39 $this->setContext($context); | |
40 | |
41 return $this->match($this->currentPath->getPath($request)); | |
42 } | |
43 | |
44 } |