Follow-up to #2010132: Canonical taxonomy term link for forum vocabulary is broken

Problem/Motivation

Trying to override taxonomy term URL generation for forum pages I found that there's only a path ($route->getPath()) to identify route. But forum module needs to alter only "canonical" (default) term link (route)

Proposed resolution

Pass $route_name as third argument

Remaining tasks

TBD

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
We have manually tested the patch and confirmed that it has not been rolled. Novice Instructions Yes
Reroll the patch. Instructions Yes
Draft a change record for the API changes Instructions

User interface changes

no

API changes

new argument in interface

Comments

andypost’s picture

StatusFileSize
new3.69 KB

Status: Needs review » Needs work

The last submitted patch, 1: 2283851-1.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new2.51 KB
new6.21 KB

Fix broken tests

damiankloip’s picture

+++ b/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php
@@ -37,7 +37,7 @@ function __construct(CsrfTokenGenerator $csrf_token) {
+  public function processOutbound(Route $route, array &$parameters, $name) {

This param should probably be called $route_name, I think it is called this almost everywhere else.

andypost’s picture

StatusFileSize
new3.16 KB
new6.26 KB

Yes $route_name is more consistent

dawehner’s picture

+++ b/core/lib/Drupal/Core/Access/RouteProcessorCsrf.php
@@ -37,7 +37,7 @@ function __construct(CsrfTokenGenerator $csrf_token) {
+  public function processOutbound(Route $route, array &$parameters, $route_name) {

tbh I would expect route_name, route_object and parameters as last argument.

dawehner’s picture

Note: Earlier versions of #2302563: Access check Url objects actually expanded our route objects to contain the route names itself, which I think would be a sane idea. Did we considered to do that, instead of the "workaround" currently
proposed by this issue?

andypost’s picture

@dawehner Not sure how fixed issue #7 related here but originally the issue is follow-up from #2010132: Canonical taxonomy term link for forum vocabulary is broken
That means that outbound route needs to know the name to effectively compare.
But that name does not exists now or could be optional in case route object is created manually... so no idea how to implement it right.

dawehner’s picture

@dawehner Not sure how fixed issue #7 related here but originally the issue is follow-up from #2010132: Convert taxonomy_term_uri() to $term->uri()

Please reread my answer. "Earlier version of ... actually expanded our route objects to contain the route names itself".

andypost’s picture

Status: Needs review » Closed (duplicate)
damiankloip’s picture

@andypost, sorry - I totally forgot we had this issue!!

gisle’s picture

Removing spurious tags - https://www.drupal.org/node/1207020