Posted by magicmirror on January 26, 2013 at 6:08pm
5 followers
| Project: | Pathauto |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Dave Reid |
| Status: | patch (to be ported) |
Issue Summary
I've setup a listing with this pattern:
store/[node:field-store-address:locality]-[node:field-store-address:administrative_area:]/[node:title]
However, some of the store types don't have the address field fully populated. In that case, I get two slashes and only need one:
http://www.mydomain.com//[node:title]
How do I have it remove the slashes if those fields are empty? So it would be:
http://www.mydomain.com/[node:title]
Thanks for your help. 3 hours into this and figured I would ask for a lifeline here.
Comments
#1
Any thoughts on this? Would sure appreciate some feedback.
#2
Is your separator in Pathauto set to the dash character? If those two tokens produce empty output, that is strange because Pathauto should recognize that the resulting string (with leading / trailing separators trimmed) would be empty.
#3
Hrm, actually looking at the code, it looks like this may not actually meet any of the code conditions to get cleaned up in Pathauto.
#4
Let's start with some tests to confirm the behavior.
#5
The last submitted patch, 1899806-multiple-empty-tokens-pathauto-clean-alias-tests.patch, failed testing.
#6
Yes, my separator is set to the dash. Thanks for taking a look at this.
#7
Ok, let's test this one.
#8
Committed #7 to 7.x-1.x and a new 7.x-1.x-dev release will be available within 12 hours. http://drupalcode.org/project/pathauto.git/commit/88c2b14
Thanks magicmirror for reporting this edge case!
#9
#10
Seriously awesome! Thank you!
#11
Could I apply this patch to vs 6.x-1.6?
#12
You could try but it might require some adjustment. It needs to be fixed in 6.x-2.x first, then backported to 6.x-1.x last.
#13
Thanks Dave. I think I'll just update the module.
#14
magicmirror: What have you done in order to be able to use [node:field-store-address:locality] as a pattern in pathauto? I only get [node:field_address] as a suggestion, but can't choose parts of the address, like locality and throughfare (from the module Address Field).
Edit: I found the answer myself: http://drupal.org/project/addressfield_tokens :)