Problem/Motivation
During DrupalEasy Office Hours, we reviewed this module and for the most part, it is working well!
One place where it fell short is the fact that tokens do not seem to be supported in the "Link (optional)" field when configuring a custom breadcrumb.
Steps to reproduce
Consider the use case where you want to have a breadcrumb like: Home > Articles > 2023 > Article title.
The "2023" link would lead to a view with a contextual filter - the link being "/articles/2023". This requires the use of a token in the "Link (optional)" field.
Create a new breadcrumb with a segment that has Label of [node:created:html_year] and a Link of /articles/[node:created:html_year] After saving, and going to an article node, note that the token in the "Link (optional)" field was not processed to the 4-digit year.
Proposed resolution
Enable tokens on "Link (optional)" fields.
Remaining tasks
Do the things.
User interface changes
More tokens!
thank you!
-mike
Comments
Comment #2
ultimikeLooking at the code (SdBreadcrumbBuilder.php ), we're pretty sure you can just add the following around line 283:
We haven't tested this - we came to this conclusion only by looking at the code, so please test well.
-mike
Comment #3
sushant-d commentedThanks Mike — great catch! Your suggestion was spot-on and pointed me in the right direction. I adopted the simplified approach with a few additional safeguards:
This is now implemented and released in 1.1.5. Thanks for the contribution!
Comment #4
sushant-d commentedComment #6
sushant-d commented