Problem/Motivation

As we realized on #1851086: Replace admin/people with a View is that overriding existing paths in views is problematic.

Therefore selecting routes by pattern is helpful to allow altering of existing views.

Proposed resolution

Extend the RouteProviderInterface which to include a getRouteByPattern method.

Remaining tasks

DO IT, WRITE TEST, HOPE IT ACTUALLY WORKS

User interface changes

NON

API changes

Extends the interface

#1851086: Replace admin/people with a View

Files: 
CommentFileSizeAuthor
#22 routing-2004300-22.patch7.29 KBdawehner
PASSED: [[SimpleTest]]: [MySQL] 57,586 pass(es).
[ View ]
#22 interdiff.txt864 bytesdawehner
#18 routing-2004300-18.patch7.21 KBdawehner
FAILED: [[SimpleTest]]: [MySQL] 56,116 pass(es), 2 fail(s), and 0 exception(s).
[ View ]
#18 interdiff.txt977 bytesdawehner
#12 interdiff.txt1007 bytesdawehner
#11 routing-2004300-11.patch6.26 KBdawehner
FAILED: [[SimpleTest]]: [MySQL] 59,439 pass(es), 1 fail(s), and 1 exception(s).
[ View ]
#6 drupal-2004300-6.patch5.27 KBdawehner
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#6 interdiff.txt1.25 KBdawehner
#3 drupal-2004300-3.patch5.27 KBdawehner
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
#1 drupal-2004300-1.patch843 bytesdawehner
PASSED: [[SimpleTest]]: [MySQL] 55,700 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new843 bytes
PASSED: [[SimpleTest]]: [MySQL] 55,700 pass(es).
[ View ]

Do we agree so far on the interface?

Seems reasonable. I might suggest not duplicating the interface name for clarity.

I presume then our implementation would then just subcall to that method from getRoutesByRequest(), since it would be all the same logic anyway. (That's what we discussed in Portland.)

Onward[s]!

Component:views.module» routing system
StatusFileSize
new5.27 KB
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]

I introduced another protected method, which makes it even a bit cleaner.

Status:Needs review» Needs work

The last submitted patch, drupal-2004300-3.patch, failed testing.

+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -239,4 +219,47 @@ public function getCandidateOutlines(array $parts) {
+  /**
+   * {@inheritdoc}
+   */
+  public function getRoutesByPattern($pattern) {
+    $path = RouteCompiler::getPatternOutline($pattern);
+
+    return $this->getRoutesByPattern($path);
+  }

This looks suspiciously like an infinite loop. :-)

+++ b/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.php
@@ -324,6 +324,9 @@ function testOutlinePathNoMatch() {
+      $routes = $provider->getRoutesByPattern($path);
+      $this->assertFalse($routes, 'No path found with this pattern.');
+

$routes is a RouteCollection, not array, so assertFalse() isn't going to work. If you want to ensure that it's empty you can do a count($routes) == 0.

Status:Needs work» Needs review
StatusFileSize
new1.25 KB
new5.27 KB
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]

Status:Needs review» Needs work
Issue tags:-WSCCI, -VDC

The last submitted patch, drupal-2004300-6.patch, failed testing.

Status:Needs work» Needs review

#6: drupal-2004300-6.patch queued for re-testing.

Status:Needs review» Needs work
Issue tags:+WSCCI, +VDC

The last submitted patch, drupal-2004300-6.patch, failed testing.

Title:Extend the router provider interfaceExtend the router provider interface so that Views can override routes
Category:task» bug
Priority:Normal» Critical

Clarifying why this is important. Views not being able to override routes is a critical regression.

Status:Needs work» Needs review
StatusFileSize
new6.26 KB
FAILED: [[SimpleTest]]: [MySQL] 59,439 pass(es), 1 fail(s), and 1 exception(s).
[ View ]

Oh, I would have not thought that this could break it.

StatusFileSize
new1007 bytes

Here is the interdiff.

Status:Needs review» Needs work
Issue tags:-WSCCI, -VDC

The last submitted patch, routing-2004300-11.patch, failed testing.

Status:Needs work» Needs review

#11: routing-2004300-11.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, routing-2004300-11.patch, failed testing.

Status:Needs work» Needs review

#11: routing-2004300-11.patch queued for re-testing.

Status:Needs review» Needs work
Issue tags:+WSCCI, +VDC

The last submitted patch, routing-2004300-11.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new977 bytes
new7.21 KB
FAILED: [[SimpleTest]]: [MySQL] 56,116 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

One less fail.

Status:Needs review» Needs work

The last submitted patch, routing-2004300-18.patch, failed testing.

+++ b/core/modules/system/lib/Drupal/system/Tests/Routing/RouteProviderTest.phpundefined
@@ -348,7 +351,9 @@ function testSystemPathMatch() {
+    $this->assertEqual($routes_by_pattern, $routes);

This needs a message, because assertEqual is trying to var_dump the object for the message

The user password reset seems spurious. I had it crop up weirdly in the entity uri issue, too, but couldn't replicate locally. Probably transient testbot weirdness.

Status:Needs work» Needs review
StatusFileSize
new864 bytes
new7.29 KB
PASSED: [[SimpleTest]]: [MySQL] 57,586 pass(es).
[ View ]

Thanks tim!!

Status:Needs review» Reviewed & tested by the community

Nice, even better.

+1 from me as well.

Status:Reviewed & tested by the community» Fixed

Committed c707cf7 and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.