I am working on a site where the main page is a sub-section of a larger (non-drupal) website. So I wanted to add the url of the main website as the first breadcrumb item. So I implemented hook_path_breadcrumbs_view_alter() and successfully added the a new breadcrumb item to the front of every trail.

However, the module kept rewriting my url. I did some digging and found the issue was at line 354 of path_breadcrumbs.module. So I hacked a quick solution that changes $href = ''; to $href = $matches[1]; on line 355. So I guess I am curious what cases you are trying to catch with this if statement:

// Means that this is href to the frontpage.
if (drupal_strlen($base_string) > drupal_strlen($matches[1])) {

Are you trying to catch cases where people hardcode example.com as the front page url, instead of using <front>?

So I guess if you could clarify what you are trying to catch, then I can put together a quick patch to still catch those situation, while allowing situations like mine to pass through un-altered.

Thanks.

CommentFileSizeAuthor
#6 2066223-path_breadcrumbs_test_export.txt855 byteskalabro
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kalabro’s picture

Hello, @adamzimmermann!
As I know external URLs are not working correctly if you use PB render function for breadcrumbs. We will fix it soon.

Are you trying to catch cases where people hardcode example.com as the front page url, instead of using ?

It is because PB parses any breadcrumbs (from other modules for example) if setting “Use module breadcrumbs render function” is enabled.

kalabro’s picture

Version: 7.x-3.0-beta4 » 7.x-3.x-dev
Status: Active » Needs review

Now this statement replaced: http://drupalcode.org/project/path_breadcrumbs.git/commitdiff/152afe6

@Spleshka, could you please explain why it was used initially?

kalabro’s picture

Assigned: Unassigned » Spleshka

Let's ask him.

Spleshka’s picture

Status: Needs review » Needs work

Heh, unfotrunately, I don't remember the exact reason. I used to spend a lot of time debugging this and found a way of solving several issues with such condition. Maybe it help to deal with the cases when drupal located in subfolder. Or maybe for subdomains. I really can't tell you exactly.

So if you want to put this instead, please test all cases with different $base_url and different breadcrumbs. Note that administrative and custom breadcrumbs are build differently, so please check this too.

kalabro’s picture

Assigned: Spleshka » Unassigned

Ok, let's test it more carefully.

kalabro’s picture

So, we need manual tests on latest HEAD in these cases:

  1. Normal domain (example.com)
  2. Subfolder (example.com/subfolder)
  3. Subdomain (subdomain.example.com)

In each case we have to:

  1. Enable PB render function.
  2. Add second language (RU, for example) and enable URL detection method.
  3. Test Path Breadcrumbs variant with front, internal and external links (example attached) with and without language prefix.
  4. Check system breadcrumbs (which are not built with PB) with and without language prefix.
  5. Check administrative breadcrumbs with and without language prefix.

Any help!

kalabro’s picture

kalabro’s picture

Status: Needs work » Needs review
kalabro’s picture

After deep testing I have prepared overall commit for this issue: http://drupalcode.org/project/path_breadcrumbs.git/commitdiff/21790cd

adamzimmermann’s picture

@kalabro Thank you so much for looking into this and fixing it. I tried this out locally and it worked perfectly.

kalabro’s picture

Status: Needs review » Fixed

Now in 7.x-3.0-beta6 release!

Status: Fixed » Closed (fixed)

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