From f3c0bc05d74b3af433dddb35d13d0c018054b493 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Thu, 21 Aug 2014 12:10:46 +0100
Subject: [PATCH] Issue #2322933 by Xano: Fixed Module list form fatals due to
 incorrect route configuration.

---
 core/modules/system/src/Form/ModulesListForm.php     |  1 +
 .../system/src/Tests/Form/ModulesListFormWebTest.php |  2 +-
 .../src/Controller/SystemTestController.php          | 12 ++++++++++++
 .../modules/system_test/system_test.routing.yml      |  2 ++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php
index 6d9cd8834f35..1fa64f57cc4e 100644
--- a/core/modules/system/src/Form/ModulesListForm.php
+++ b/core/modules/system/src/Form/ModulesListForm.php
@@ -288,6 +288,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
           $request->attributes->set('_route_name', $module->info['configure']);
           $route_object = $this->routeProvider->getRouteByName($module->info['configure']);
           $request->attributes->set('_route', $route_object);
+          $request->attributes->add($route_parameters);
           $description = $this->titleResolver->getTitle($request, $route_object);
         }
 
diff --git a/core/modules/system/src/Tests/Form/ModulesListFormWebTest.php b/core/modules/system/src/Tests/Form/ModulesListFormWebTest.php
index d401e52891dd..7f4f2d67a657 100644
--- a/core/modules/system/src/Tests/Form/ModulesListFormWebTest.php
+++ b/core/modules/system/src/Tests/Form/ModulesListFormWebTest.php
@@ -38,6 +38,6 @@ public function testModuleListForm() {
     $this->assertResponse('200');
 
     // Check that system_test's configure link was rendered correctly.
-    $this->assertLinkByHref('configure/bar');
+    $this->assertFieldByXPath("//a[contains(@href, '/system-test/configure/bar') and @title='Bar.bar']");
   }
 }
diff --git a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
index 36a2c8ffffac..0b9290b1a6c9 100644
--- a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
+++ b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
@@ -91,4 +91,16 @@ public function shutdownFunctions($arg1, $arg2) {
     }
   }
 
+  /**
+   * Returns the title for system_test.info.yml's configure route.
+   *
+   * @param string $foo
+   *   Any string for the {foo} slug.
+   *
+   * @return string
+   */
+  public function configureTitle($foo) {
+    return 'Bar.' . $foo;
+  }
+
 }
diff --git a/core/modules/system/tests/modules/system_test/system_test.routing.yml b/core/modules/system/tests/modules/system_test/system_test.routing.yml
index cd070ac1c6b6..520ba3737fbc 100644
--- a/core/modules/system/tests/modules/system_test/system_test.routing.yml
+++ b/core/modules/system/tests/modules/system_test/system_test.routing.yml
@@ -75,5 +75,7 @@ system_test.shutdown_functions:
 
 system_test.configure:
   path: '/system-test/configure/{foo}'
+  defaults:
+    _title_callback: '\Drupal\system_test\Controller\SystemTestController::configureTitle'
   requirements:
     _access: 'TRUE'
-- 
GitLab