Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The "Transform dashes in URL to spaces in term name filter values" option breaks if the taxonomy term has a dash in it.
Comment | File | Size | Author |
---|---|---|---|
#7 | ctools-term-dashes-2320779-7.patch | 963 bytes | klausi |
#6 | ctools-term-dashes-2320779-6.patch | 980 bytes | klausi |
Comments
Comment #1
joshua.roberson CreditAttribution: joshua.roberson commentedI have the same problem.
Vocabulary terms:
Eagle Ford [works: /sc/eagle-ford]
Marcellus-Utica Midstream [fails, should be: /sc/marcellus-utica-midstream]
It seems like the process is to take the URL taxonomy and convert the hyphens to spaces before comparing it to the terms. This seems backwards. It should take the terms and convert the spaces to hyphens (SEO friendly URLs) and compare them to the URL taxonomy which is already SEO friendly.
I also notice that if the term name has an ampersand (&) like "Latin America & Caribbean", the URL taxonomy has to have the ampersand in it. I'm sure it is the same for other special characters.
works: /sc/latin-america-&-caribbean
shoule be: /sc/latin-america-caribbean
Comment #2
DamienMcKenna@jrobertson: The URL is not expected to be customized like that, it literally only converts spaces to dashes and makes the string lowercase, it doesn't do anything else, so your URL shouldn't change that way.
I think the problem is that we're used to the magic Pathauto can do and want it for these pages too, when it doesn't have that level of functionality.
Comment #3
erikwebb CreditAttribution: erikwebb commentedWhat if we urlencode the original hyphen prior to the hyphen/space sub, then on load, do the hyphen/space sub prior to urldecode? That should avoid this problem.
str_replace('-', '%2D', $str);
Comment #4
DamienMcKennaFYI I ended up building a work-around using the Safeword module and the following patch: #2329443: CTools argument
Comment #5
DamienMcKennaErik: From experience, this doesn't really provide the flexibility that many sites need, they want something more akin to the clean URLs provided by Pathauto.
Comment #6
klausiI think we should only transform dashes to spaces as a fallback if no terms could be loaded. Patch attached.
Comment #7
klausiRerolled.
Comment #8
khyam CreditAttribution: khyam commentedFor reference to anyone, patch works great for terms with hyphenated names. It doesn't however work for terms with a hyphenated name and a space.
Example:
practice-related : works
practice-related news : doesn't work
In our case the url had to be /practice-related%20news/ in order to make this work
Comment #9
joelpittetMaybe it needs to be url decoded?
Comment #10
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedNeeds work per the comment in #8 and #9