This is a clarification of a comment I originally made in #256225: White space improperly converted?. I am reposting this with additional information because in retrospect I am not sure if it actually related to the original problem described there after all.
I do not get correct breadcrumb paths when using [bookpath-raw].
(Drupal 6.3, pathauto 6.x.1.1, token 6.x.1.11, custom breadcrumbs 6.x-1.3)
Create a book with two (book page) child pages:
top level book
middle level book
bottom level book
The automated pathauto pattern for book pages is [bookpath-raw]/[title-raw].
Pathauto correctly gives all of the url aliases, replacing spaces with dashes (as I have it configured):
.../top-level-book
.../top-level-book/middle-level-book
.../top-level-book/middle-level-book/bottom-level-book
The configuration for custom breadcrumbs path for book pages is:
book
[bookpath-raw]
node/[nid]
Selecting the last portion of the breadcrumb yields the correct url (dashes instead of spaces):
../top-level-book/middle-level-book/bottom-level-book
However, selecting the middle portion of the breadcrumb (corresponding to [bookpath-raw] yields breadcrumb urls like
.../top level book/middle level book
notice the spaces...I think these should be dashes. Everything would work as intended if those spaces would be replaced with dashes.
Since the aliases are being correctly created by pathauto using the [bookpath-raw] token, I figure it may be a bug in custom breadcrumbs?
Any help or advice on how to further clarify this problem would be appreciated!
Comment | File | Size | Author |
---|---|---|---|
#4 | custom_breadcrumbs.patch | 5.15 KB | babbage |
#1 | custom_breadcrumbs_special.admin_.inc_.patch | 859 bytes | MGN |
#1 | custom_breadcrumbs_special.module.patch | 2.51 KB | MGN |
Comments
Comment #1
MGN CreditAttribution: MGN commentedHere is a patch that fixes this problem, originally contributed for 5.x in #289810: Special Behaviors by jmstacey. I just reformated it so that I could apply it to 6.x-1.3. Its a nice patch which will clean the path according to pathauto rules when an identifier
<pathauto>|
is prefixed to the path. Also includes help documentation on the custom breadcrumbs admin form.Now when I use
<pathauto>|[bookpath-raw]
for the custom breadcrumbs path setting, the breadcrumb works as expected!I have it working on several sites Drupal 6.3 sites now and haven't had any problems.
Comment #2
MGN CreditAttribution: MGN commentedOops.... Forgot to change the status.
Comment #3
babbage CreditAttribution: babbage commentedI have reviewed this patch and have tested it. I recommend it be committed to custom_breadcrumbs.
I believe this issue is an important one and is one that has been reported by other users and is an issue I myself faced. The solution makes good use of existing functionality provided by the pathauto module specifically for the current purpose—of cleaning paths using pathauto settings.
I reviewed this code to confirm it was a good solution to the problem. I then re-rolled the patch for 6.x-1.x-dev (2008-Oct-17), and tested it against Drupal 6.6 in both a clean install with no other modules installed (other than Administration Menu) and against a development server version of a fully configured site. The patch provides the planned functionality which works as proposed.
In addition to re-rolling the patch for the current dev version of custom_breadcrumbs, I also:
<none>
which was not previously documented.(Title of thread edited to better reflect nature of patch.)
Comment #4
babbage CreditAttribution: babbage commentedIt appears editing my comment removed the attached patch—or I just didn't attach it. Either way, here it is. :)
Comment #5
babbage CreditAttribution: babbage commentedNo activity for a couple of weeks here and this patch appears to work well so will mark as RTBC in the hope of getting this committed or at least reviewed by a maintainer.
Comment #6
thePanz CreditAttribution: thePanz commentedHi, your patch is great, I'd like to point that this patch doesn't deal with "pathauto change case" changing.
I edited custom_breadcrumbs.module to have, near line 147 this code:
Now custom_breadcrumbs generates URLs in lowercase if pathauto is setted to do that.
Regards
Comment #7
babbage CreditAttribution: babbage commented@thePanz: the issue you raise resulted from a bug in Pathauto not with Custom Breadcrumbs, and that bug has already been fixed in #343851: pathauto_cleanstring() does not convert to lowercase (consolidate all text altering code to pathauto_cleanstring) though that patch has not yet been committed. Thus, the change you suggest is not required. Reverting to RTBC.
Comment #8
thePanz CreditAttribution: thePanz commented@dbabbage: you're right! the patch you pointed is the right solution! Thank you!
Regards
Comment #9
babbage CreditAttribution: babbage commentedYou're welcome. It was an easy find—I am rather familiar with patch #343851: pathauto_cleanstring() does not convert to lowercase (consolidate all text altering code to pathauto_cleanstring). ;)
Comment #10
thePanz CreditAttribution: thePanz commentedehehe, you're right :) I just noticed issue's author name ;)
but... is pathauto 2.x usable for a "stable" use? Your patch in #343851: pathauto_cleanstring() does not convert to lowercase (consolidate all text altering code to pathauto_cleanstring) referres to 2.x-dev release and I'm using latest 1.x!
Sorry for my [OT] :)
Comment #11
babbage CreditAttribution: babbage commentedI am just one user of Pathauto but I am using the -dev version (with my patch obviously) and it has been rock solid--but I suggest check the issue queue and see if anything of concern.
Comment #12
nitrospectide CreditAttribution: nitrospectide commentedI tried running this patch against both 6.x-1.4 and the 6.x-1.dev version but get an error:
-bash: syntax error near unexpected token `newline'
Am I doing something wrong, or is the problem that the codebase has changed and the patch needs updating?
Comment #13
MGN CreditAttribution: MGN commentedWhat command syntax are you using to apply the patch? Thats not the kind of error you would get if the codebase was modified. Seems like you didn't give the correct patch command... See http://drupal.org/node/60108. Hope this helps!
Comment #14
nitrospectide CreditAttribution: nitrospectide commentedAh! I am still new to patching. I ran it this time without the -p0, and it worked.
Now, I am getting a glitch. I have this line in my paths window:
blogs/myblog/
|[title-raw]
and when I click the associated crumb on the page, it links me to:
http://www.mysite.net/blogs/myblog/
|Episode 33
It doesn't seem to be interpreting it. I know the patch worked, because the helper text explaining the pipe syntax is at the bottom of the screen - but something else seems to be amiss.
Comment #15
MGN CreditAttribution: MGN commentedI think you are forgetting the
identifier before the pipe - check the example again... Also, put the identifier at the begining of the path, like this:
<pathauto>|blogs/myblog/[title-raw]
Hope this helps!
Changing the name and version back so we don't get confused... Hopefully, someday, we will be able to commit this patch...
Comment #16
nitrospectide CreditAttribution: nitrospectide commentedThanks!
I just noticed that the identifier did not paste in for some reason when I posted last night. My code should have read:
blogs/myblog/<pathauto>|[title-raw]
And here's the rub - the example in the help text doe not show a multi-part path. It only shows a single-part path. So I was under the impression that you had to put the identifier and pipe immediately before the single element you wanted cleaned - not in front of the entire path. As I reread now, I see where I missed it, but think this was perhaps easy to misunderstand. I recommend changing the help text to clarify that the identifier and pipe should pre-pend the whole path by showing a multipart example.
Now I just have to get PathAuto patched to make things lowercase...
Comment #17
MGN CreditAttribution: MGN commentedI agree we need to work on the documentation here.
Comment #18
MGN CreditAttribution: MGN commentedCommitted to 6.x-1.x-dev.