Download & Extend

Consider merging with menu_breadcrumb

Project:Menu Trails
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Though menutrails and menu_breadcrumb are similar, both of these modules have some unique strengths. I've found myself trying to combine the benefits of each; unfortunately I haven't found a way to use both modules together. (The menutrails breadcrumbs take precedence if enabled.)

Advantages of menutrails:
Sets crumbs for nodes that aren't in the menu, by content type and taxonomy.

Advantages of menu_breadcrumb:
Several useful display options(append title to crumbs, append as link, hide when only "home" is in the trail).
Seems to have a more efficient method of actually setting the active trail; unlike menutrails it doesn't require a phptemplate_...() override function.

Thanks!

Comments

#1

I'd be happy to merge in some features of that module. Especially, appending the current page's title to the breadcrumb sounds nice.

However, we'd need to turn this issue into a "meta issue" and spin off separate feature requests for the individual changes to separate issues.

Also, I'm not sure whether I'll have time to work on it, but definitely happy to review + commit any patches!

#2

See the corresponding issue on Menu breadcrumb: #560464: Consider merging with menutrails.

Indeed there is overlap between the two modules. The most useful initial step would be to remove the direct overlap to make is possible for the two modules to work together.

The core concern of menutrails is: Enable setting a default parent menu item for given nodes (nodes of a type, nodes with a taxonomy terms, nodes in a given organic group) which, implicitly at least, are not themselves included in the menu hierarchy.

The core concern of menu breadcrumb is: If there is a menu item for the current path, build a nested breadcrumb including the parents of the current path.

When the two are looked at in this way, there's no obvious reason for conflict. That is,

Main problems currently are:

  • Menu breadcrumbs sets the breadcrumb for all paths, whether or not they have a menu item. This problem is partially mitigated by the fact that breadcrumbs are set in hook_init(), meaning that other modules have an opportunity to override them.
  • Menu trails sets breadcrumbs for all nodes, not only the ones it is configured to handle, and also for some other items (views page displays). This leads to the bug in #702350: Page title is always included in the breadcrumb for node not processed by menutrails.

Interestingly, although they achieve a similar result, the two modules take very different approaches to determining the breadcrumbs to set. Menu breadcrumb takes advantage of the fact that Drupal core already supports nested menu-based breadcrumbs (but only for the navigation menu). By setting as active the menu of the current menu item (by calling menu_set_active_menu_name()), drupal_get_breadcrumb() fetches the nested items. Menu trails in contrast constructs a custom breadcrumb based on menu information. Before any deep integration of the two, probably it would be necessary to decide on one or the other of these approaches.

The simplest and probably best short term approach would be:

  1. Remove all breadcrumb handling from menutrails that is not related to its core aim. Specifically, don't process nodes other than the ones it handles, see patch in #702350: Page title is always included in the breadcrumb for node not processed by menutrails, and don't set breadcrumbs for views. This step should make the two compatible, since menutrails will override the breadcrumbs set by menu breadcrumb in hook_init(). (Though see the patch in #275622: Doesn't work for Views pages, which would move breadcrumb setting to after hook_nodeapi('view').)
  2. Patch menu breadcrumb to set breadcrumbs only if there is a menu item for the current path.
  3. Consider introducing conditional logic into menutrails to make it aware of menu breadcrumb options for appending the current path to the breadcrumb. Or else remove this logic from menu breadcrumb and let another module handle it.
nobody click here