"/" characters are removed from the breadcrumb link which is output when using the
| identifier.
any line calling the pathauto_cleanstring function with the second parameter should be updated, as the second param is no longer supported
suggested code for stable version (custom_breadcrumbs.module line 158):
$patharray = explode('/', $path);
foreach($patharray as $k=>$v){
$patharray[$k] = pathauto_cleanstring($v);
}
$path = implode('/', $patharray);
$crumb = l($title, $path);
suggested code for beta 3 - (custom_breadcrumb_identifiers.module):
$patharray = explode('/', $options['path']);
foreach($patharray as $k=>$v){
$patharray[$k] = pathauto_cleanstring($v);
}
$options['path'] = implode('/', $patharray);
$crumb = l($obj['title'], $options['path'], $options);
Sorry, not sure how to do a patch.
This also does not account for '/' characters in token fields, which should be processed separately and also needs to be resolved.
Comment | File | Size | Author |
---|---|---|---|
#14 | 884370_pathauto_cleanstring_fix_61.diff | 943 bytes | MGN |
#5 | 884370_pathauto_cleanstring_fix.diff | 1.11 KB | MGN |
Comments
Comment #1
murraybiscuit CreditAttribution: murraybiscuit commentedlet's try that first line again...
"/" characters are removed from the breadcrumb link which is output when using the <pathauto>| identifier.
Comment #2
seehawk CreditAttribution: seehawk commentedHaving the exact same issue on my site.
Comment #3
MGN CreditAttribution: MGN commentedThanks for reporting this. I think #881276: Fatal error: Call to undefined function pathauto_cleanstring() is reporting the same problem, but this issue has more information so I'll mark that issue as a duplicate. That issue indicates that 6.x-2.x doesn't have this problem, so the solution is to backport the changes that have been made in the 6.x-2.x version.
Comment #4
dwadson CreditAttribution: dwadson commentedUpdating to 6.x-2.x removes the "Fatal error: Call to undefined function pathauto_cleanstring()", but the slashes ("/") are still being removed from the breadcrumb links.
Comment #5
MGN CreditAttribution: MGN commentedI've confirmed that pathauto integration is now broken in both 6.x-1.x and 6.x-2.x versions of custom breadcrumbs due to the the change to the pathauto_cleanstring function introduced in #545216: Fix pathauto_cleanalias() and pathauto_cleanstring().
I think murraybiscuit's suggestion is correct. I don't think there will be any problem with slashes in token strings because by the time this function is called, tokens have already been replaced.
Attached is a patch for 6.x-2.x-dev. I would appreciate it if others could test this and verify that it fixes the problem before I commit it.
Comment #6
qds013 CreditAttribution: qds013 commentedMGN, thanks for the patch! I confirm it works now with pathauto 6.x-1.4.
Comment #7
leon85321 CreditAttribution: leon85321 commentedHi, thx for the fix, but it does not work for me.
this works ->
|[term-raw]/[title-raw]
this does not work -> [title-raw]/
|[term-raw]
Comment #8
ecksley CreditAttribution: ecksley commentedAfter a recent update to 6.x-2.x-dev I found that my existing breadcrumb paths which were configured like the following such:
/<pathauto>|node/21
were outputting as:
http://myurl.com/node21
I have since changed my path configuration to:
/node/21
and it now outputs the full url alias as it once had because of the extra path auto segment. Perhaps the path auto feature is now cooked into all custom breadcrumbs without the manual designation?
That said, I also ran your patch and it is working for me. I guess the question is, should I go ahead and redo my breadcrumbs anyway if the path auto feature seems to work without the prefix?
Thanks for the patch!
Comment #9
MGN CreditAttribution: MGN commented@leon,
The pathauto identifier is designed to be the first item on the line so the correct usage is
<pathauto>|[term-raw]/[title-raw]
Your second scenario (
[title-raw]/<pathauto>|[term-raw]
) shouldn't work....at least it wasn't designed for that kind of usage...Comment #10
MGN CreditAttribution: MGN commented@ecksley, I am not sure I am following your question.
I can't think of a scenario where
node/21
would need the pathauto special identifier. If an alias for node/21 exists it will automatically be used (see the url api function for details).The pathauto special identifier is useful if you need to clean a string according to the pathauto rules - for example, replacing spaces returned by tokens with dashes or underscores or....
But it sounds like we can go to RTBC on the patch.
Comment #11
ecksley CreditAttribution: ecksley commentedThanks for explaining that MGN. I misunderstood the use of the pathauto identifier.
Comment #12
MGN CreditAttribution: MGN commentedThis has now been committed to 6.x-2.x-dev.
Comment #13
MGN CreditAttribution: MGN commentedStill need to fix the 6.x-1.x-dev branch.
Comment #14
MGN CreditAttribution: MGN commentedHere is the patch using murraybiscuit's code. I would appreciate it if someone could test it against the latest code and verify that it works as expected. Thanks.
Comment #15
texas-bronius CreditAttribution: texas-bronius commentedHi - fwiw, the patch in #14 fails against stable 6.x-1.5 for me. Yes, I know this is a patch against -dev.
Note to others: If manually applying the patch this patch to 1.5, you will need to prepend:
module_load_include('inc', 'pathauto', 'pathauto');
to gain access to the
pathauto_cleanstring
function.Comment #16
MGN CreditAttribution: MGN commentedDo you mean the path fails to apply or that, after manually pathcing, the patch doesn't fix the problem?
Comment #17
texas-bronius CreditAttribution: texas-bronius commentedOk so regarding the patch in #14, the custom_breadcrumbs generated link to the document is a full path, whereas the path generated by pathauto is truncated a bit-- therefore the two don't sync up. This may be an unrelated issue.
Ex:
for the pathauto setting:
about-us/press-releases/[field_pr_date-yyyy]/[title-raw]
pathauto generates this path:
about-us/press-releases/2006/kirk-heinritz-appointed-vp-corporate-strategy-and-organizational-develo
custom_breadcrumbs generates this path:
about-us/press-releases/2006/kirk-heinritz-appointed-vp-corporate-strategy-and-organizational-development
(notice the "ment" at the end of custom_breadcrumbs generated path)
Comment #18
cyberderf CreditAttribution: cyberderf commentedWell I'm confused.
What releases of pathauto/custom breadcrumbs works together, and with which patch.
Can someone sort it out for me! ;)
Comment #19
cyberderf CreditAttribution: cyberderf commentedBy the way last dev version is from 2010-Oct-27. I still have the bug. Why is this patch not added to the lasat release ?
Comment #20
MGN CreditAttribution: MGN commentedThe patch hasn't been committed yet because it hasn't been tested and marked RTBC yet. All of my sites are running 6.x-2.x-dev now, so I'll need some help to troubleshoot these problems. I don't see any problems with 6.x-2.x-dev and pathauto 6.x-1.4 - sorry I haven't had a chance to upgrade to pathauto 6.x-1.5 and test it yet. I do see that there has been some important recent changes in pathauto 6.x-1.5 so the problems that you are seeing might be related to that.
@texas-bronius, it looks like pathauto is truncating at 100 characters - from reading through the recent commits to pathauto, I think this is a new setting in the pathauto module. You might be able to fix the problem by increasing the maximum length of the pathauto alias. It looks like the pathauto_cleanstring function (which custom breadcrumbs has been using...) does not truncate. Sorry I can't offer more help on this since I am still on pathauto 6.x-1.4...
Comment #21
laroccadahouse CreditAttribution: laroccadahouse commentedi'm using 1.5 and applied the patch from #14. works for me!
Comment #22
lamp5