diff --git a/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php b/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php index b2137d9cfead1f31ecb388546fcfa213537d7dbb..b4851c71a35dd5e64ef2baf9d7cb80c3b7b344d9 100644 --- a/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php +++ b/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php @@ -37,7 +37,7 @@ function __construct(CsrfTokenGenerator $csrf_token) { /** * {@inheritdoc} */ - public function processOutbound(Route $route, array &$parameters) { + public function processOutbound($route_name, Route $route, array &$parameters) { if ($route->hasRequirement('_csrf_token')) { $path = ltrim($route->getPath(), '/'); // Replace the path parameters with values from the parameters array. diff --git a/core/lib/Drupal/Core/RouteProcessor/OutboundRouteProcessorInterface.php b/core/lib/Drupal/Core/RouteProcessor/OutboundRouteProcessorInterface.php index c9bda247fe8dec9788f97afd57b721a726c5806f..145c8eea63fa3e711f1490ba248fbb3ec20afe19 100644 --- a/core/lib/Drupal/Core/RouteProcessor/OutboundRouteProcessorInterface.php +++ b/core/lib/Drupal/Core/RouteProcessor/OutboundRouteProcessorInterface.php @@ -17,9 +17,10 @@ interface OutboundRouteProcessorInterface { /** * Processes the outbound route. * + * @param string $route_name + * The route name. * @param \Symfony\Component\Routing\Route $route * The outbound route to process. - * * @param array $parameters * An array of parameters to be passed to the route compiler. Passed by * reference. @@ -27,6 +28,6 @@ interface OutboundRouteProcessorInterface { * @return * The processed path. */ - public function processOutbound(Route $route, array &$parameters); + public function processOutbound($route_name, Route $route, array &$parameters); } diff --git a/core/lib/Drupal/Core/RouteProcessor/RouteProcessorManager.php b/core/lib/Drupal/Core/RouteProcessor/RouteProcessorManager.php index 3dc8864d773c36c99d19179ece9199fa8a02cec5..049fc7cb9c285581722a58e4f43efa297d85a43f 100644 --- a/core/lib/Drupal/Core/RouteProcessor/RouteProcessorManager.php +++ b/core/lib/Drupal/Core/RouteProcessor/RouteProcessorManager.php @@ -50,10 +50,10 @@ public function addOutbound(OutboundRouteProcessorInterface $processor, $priorit /** * {@inheritdoc} */ - public function processOutbound(Route $route, array &$parameters) { + public function processOutbound($route_name, Route $route, array &$parameters) { $processors = $this->getOutbound(); foreach ($processors as $processor) { - $processor->processOutbound($route, $parameters); + $processor->processOutbound($route_name, $route, $parameters); } } diff --git a/core/lib/Drupal/Core/Routing/NullGenerator.php b/core/lib/Drupal/Core/Routing/NullGenerator.php index a271538d0d07407b6b613426e441e66f9287c0b6..6ec6e118568a86a04e3a34807f3ab2ed4ff55f93 100644 --- a/core/lib/Drupal/Core/Routing/NullGenerator.php +++ b/core/lib/Drupal/Core/Routing/NullGenerator.php @@ -44,7 +44,7 @@ protected function getRoute($name) { /** * {@inheritdoc} */ - protected function processRoute(Route $route, array &$parameters) { + protected function processRoute($name, Route $route, array &$parameters) { } /** diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php index ae41c9c4f5fcdf5c44777bbcdd9636f171fb7509..ef8d9c9681f0105a8a77857c31de46fec1ae32a4 100644 --- a/core/lib/Drupal/Core/Routing/UrlGenerator.php +++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php @@ -160,7 +160,7 @@ public function generateFromRoute($name, $parameters = array(), $options = array $options += array('prefix' => ''); $absolute = !empty($options['absolute']); $route = $this->getRoute($name); - $this->processRoute($route, $parameters); + $this->processRoute($name, $route, $parameters); // Symfony adds any parameters that are not path slugs as query strings. if (isset($options['query']) && is_array($options['query'])) { @@ -331,12 +331,13 @@ protected function processPath($path, &$options = array()) { * * @param \Symfony\Component\Routing\Route $route * The route object to process. - * * @param array $parameters * An array of parameters to be passed to the route compiler. + * @param string $name + * The route name. */ - protected function processRoute(SymfonyRoute $route, array &$parameters) { - $this->routeProcessor->processOutbound($route, $parameters); + protected function processRoute($name, SymfonyRoute $route, array &$parameters) { + $this->routeProcessor->processOutbound($name, $route, $parameters); } /** diff --git a/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php b/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php index 871ffb06aef7c4b08b65cfef6cc06889ccd86fac..48f77b9c7bf6846a3b10f0f5c51b87228b0a50ec 100644 --- a/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php +++ b/core/tests/Drupal/Tests/Core/Access/RouteProcessorCsrfTest.php @@ -49,7 +49,7 @@ public function testProcessOutboundNoRequirement() { $route = new Route('/test-path'); $parameters = array(); - $this->processor->processOutbound($route, $parameters); + $this->processor->processOutbound('test', $route, $parameters); // No parameters should be added to the parameters array. $this->assertEmpty($parameters); } @@ -67,7 +67,7 @@ public function testProcessOutbound() { $route = new Route('/test-path', array(), array('_csrf_token' => 'TRUE')); $parameters = array(); - $this->processor->processOutbound($route, $parameters); + $this->processor->processOutbound('test', $route, $parameters); // 'token' should be added to the parameters array. $this->assertArrayHasKey('token', $parameters); $this->assertSame($parameters['token'], 'test_token'); @@ -85,7 +85,7 @@ public function testProcessOutboundDynamicOne() { $route = new Route('/test-path/{slug}', array(), array('_csrf_token' => 'TRUE')); $parameters = array('slug' => 100); - $this->assertNull($this->processor->processOutbound($route, $parameters)); + $this->assertNull($this->processor->processOutbound('test', $route, $parameters)); } /** @@ -100,7 +100,7 @@ public function testProcessOutboundDynamicTwo() { $route = new Route('{slug_1}/test-path/{slug_2}', array(), array('_csrf_token' => 'TRUE')); $parameters = array('slug_1' => 100, 'slug_2' => 'test'); - $this->assertNull($this->processor->processOutbound($route, $parameters)); + $this->assertNull($this->processor->processOutbound('test', $route, $parameters)); } } diff --git a/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php b/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php index eacc6d8e89de994f4b2880e3c6a16234212c86ba..e002f44fd821bb006bbdaf157b1767acdf1d8d80 100644 --- a/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php +++ b/core/tests/Drupal/Tests/Core/RouteProcessor/RouteProcessorManagerTest.php @@ -34,11 +34,12 @@ protected function setUp() { public function testRouteProcessorManager() { $route = new Route(''); $parameters = array('test' => 'test'); + $route_name = 'test_name'; $processors = array( - 10 => $this->getMockProcessor($route, $parameters), - 5 => $this->getMockProcessor($route, $parameters), - 0 => $this->getMockProcessor($route, $parameters), + 10 => $this->getMockProcessor($route_name, $route, $parameters), + 5 => $this->getMockProcessor($route_name, $route, $parameters), + 0 => $this->getMockProcessor($route_name, $route, $parameters), ); // Add the processors in reverse order. @@ -46,12 +47,14 @@ public function testRouteProcessorManager() { $this->processorManager->addOutbound($processor, $priority); } - $this->processorManager->processOutbound($route, $parameters); + $this->processorManager->processOutbound($route_name, $route, $parameters); } /** * Returns a mock Route processor object. * + * @param string $route_name + * The route name. * @param \Symfony\Component\Routing\Route $route * The Route to use in mock with() expectation. * @param array $parameters @@ -59,11 +62,11 @@ public function testRouteProcessorManager() { * * @return \Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected function getMockProcessor($route, $parameters) { + protected function getMockProcessor($route_name, $route, $parameters) { $processor = $this->getMock('Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface'); $processor->expects($this->once()) ->method('processOutbound') - ->with($route, $parameters); + ->with($route_name, $route, $parameters); return $processor; }