Hi,

If you look at the _custom_breadcrumbs_create_crumb function, the way it calls the l() function breaks HTML entities. For example, I have page titles with ampersands in them. Drupal core does not check_plain() node titles because they've been sanitised already - it just spits them straight out. Problem is, the l() function checks them again and ends up over-checking HTML entities. As such, I end up with page title like this:

Science & Technology

And breadcrumb like this:

Home -> Discussion -> Science & Technology

Doh! I got around this by adding array('html' => TRUE) in to your implementation of the l() function, but if this is not desired we could move the actual link creation to a theme function so people can at least override it if they need to and not hack the module?

Hope that makes sense! =)

Comments

greg.harvey’s picture

Category: bug » feature

Thinking about it, my problem is I'm using the Page Title module to show the breadcrumbs. I guess if this were a "normal" set-up I would use the [title-raw] token, instead of the [title] and the problem would go away. Trouble is, I don't think there is a [page-title-raw] function (but I'm off to check now). For sure, running this through a theme function would be best so we can alter as needs be, if a module doesn't provide a raw token. =)

greg.harvey’s picture

Title: HTML entities broken » Move link building code to theme function

Updating title.

Related issue at Page Title queue: #691520: Create a [page-title-raw] token

MGN’s picture

Title: Move link building code to theme function » Decode HTML entities in title
Category: feature » bug

In custom breadcrumbs 6.x-2.x this was fixed by adding the following line at the beginning of the _custom_breadcrumbs_create_crumb() function

$title = decode_entities($title); 

See #318272: Decode of title suggested to handle special characters for the original issue and the drupal 6 api for information on decode entities. Looks like I bumped the fix to 6.x-2.x and failed to implement it in 6.x-1.x.

Could you try that with the current 6.x-1.x code and verify that this fixes the problem. Since it parallels the 6.x-2.x code, that would be the best solution.

greg.harvey’s picture

Status: Active » Needs review
StatusFileSize
new772 bytes

Works for me, here's a patch.

But for the record, if there was a -raw token for Page Titles I would never have reported this bug, so that's probably valid too. Always use the -raw token, if available, because Custom Breadcrumbs will check and filter anyway. =)

MGN’s picture

Status: Needs review » Fixed

What version are you working from? Doesn't look like the most recent code...

I've committed a fix to 6.x-1.x-dev that parallels the 6.x-2.x-dev code. It looks like it is already fixed in D5 (5.x-1.x-dev) as well.

http://drupal.org/cvs?commit=318120

Thanks

greg.harvey’s picture

Sorry, it's not ... it's 6.x-1.4 ... needs updating, I know, but I did check the dev snapshot before I raised an issue. ;-)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.