I'm looking to prepend an arbitrary static breadcrumb to certain nodes, have the active menu trail breadcrumbs appear, then append the non-clickable page title. I imagine it will be something like:

Arbitrary Static Link

<?php
something to fetch the active menu trail titles
?>

[title]

/url

<?php
something to fetch the active menu trail paths
?>

I've been searching for the php snippets to finish this off, but I haven't been able to locate them and don't know how to build them myself. If anyone could point me in the right direction or suggest an alternate way to accomplish the task, it would be very much appreciated.

Comments

Sorry, I didn't format the example properly:

Titles:
Arbitrary Static Link
<?php
something to fetch the active menu trail titles
?>

[title]
Paths:
/url
<?php
something to fetch the active menu trail paths
?>

<page-title>

I think this may be possible with derhasi's cb_menuidentifier module at http://github.com/derhasi/dev/tree/custom_breadcrumbs_identifier/cb_menu...

I haven't tried this, but it provides a special identifier that could work for you.

  • Working with the latest custom breadcrumbs 6.x-2.0-beta3 (or 6.x-2.x-dev), enable the custom breadcrumbs special identifiers module).
  • Enable derhasi's cb_menuidentifier module (extension to the special identifiers module.

Titles

Title of Arbitrary Static Link
<parent-menu-trail>
[title]

Paths
your/static/drupal/path
<parent-menu-trail>
<none>

It sure does look like what I need, but no luck with either 6.x-2.0-beta3 or 6.x-2.x-dev. The Static link and title appear, but there's nothing between them on the page or in the source and no error messages. I'll keep an eye on that module's development and keep looking for a solution, too.

Thanks for pointing me at the github link. I'm not sure how I'd find that otherwise.

@eliza411 - I tested the module again with the current 6.x-2.0-beta3, all works fine though. Contrary to MGNs statement your configuration of path should contain the line <parent-menu-trail>|node/[nid], as the parent menu trail works on any path you give it. I attached two screenshots that show the usage of the menu trail identifier.

@MGN, as menu is part of Drupal core, I'd suggest to implement this menu trail feature as part of the custom_breadcrumbs_identifiers.module. If you agree with this I'd write a pathc for that.

@derhasi, thanks for clearing that up. I haven't actually tried it so I really appreciate your input. I would be happy to include it in the custom_breadcrumbs_identifiers.module, if you would like to submit a patch against the current dev. Thanks again!

@derhasi - Without the |node/[nid] , nothing appeared at all. When I properly configure it per your directions, it works like a charm.

Thank you both for your work and your help on this issue!

Title:PHP Snippet for Active Menu TrailIdentifier for menu parent items
Assigned:Unassigned» derhasi
Category:support» feature
Status:Active» Needs review
StatusFileSize
new3.43 KB

As announced I implemented the functionality of my github module to the custom_breadcrumbs_identifiers. I changed the identifier from <parent-menu-items> to <menu-parent-items>.

The patch is attached and applies on the current cvs repo. @eliza411, it was nice you'd review the patch.

Status:Needs review» Reviewed & tested by the community

I was able to apply the patch cleanly. I updated the syntax in my config, and it worked as expected. Thanks again.

Status:Reviewed & tested by the community» Needs review
StatusFileSize
new3.74 KB

Great. Thanks again for contributing this! I have one suggestion for improvement and a few cosmetic changes to the documentation.

Rather than requiring the identifier to be used with a path (which will usually be node/[nid]), lets use the current path as a default value if no path is provided.

I don't think this should cause any problems, but thought it would be good to have someone else check before committing...

EDIT: Somehow I got the wrong issue number in the patch...

StatusFileSize
new3.87 KB

The patch works fine so. I only changed some spelling error in the description.
Attached the changed version.

Status:Needs review» Fixed

Thanks for the review. Committed to cvs http://drupal.org/cvs?commit=367924

Status:Fixed» Closed (fixed)

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

Category:feature» bug
Status:Closed (fixed)» Needs work

I just entered #1234566: new identifiers: menu-item-by-path, menu-item-by-id (I only just noticed the actual issue number, almost a "straight"), testers appreciated!

anyway...

I had issues by using this on a path that has more than one menu entry. This will only use the first item from the db which might not be the one needed for the breadcrumb.

I propose a modification including the approach I did in the linked issue, which basically is doing both a

menu-parent-trail-by-path (the actual one)
menu-parent-trail-by-id (a new one with a very similar code that will query the menu item by id instead of by path)

If this is wanted/acceptable I don't mind rolling a patch.