Hello, this is a wonderful module. In the custom_breadcrumbs_paths module, if the specific_path field is a textarea instead of a text field, it opens the door to creating more complex uses. In my case, I would have to define identical custom breadcrumbs for each of my sections (because they are on very different paths and the wildcard is not enough), but if this is a textarea, I can define multiple specific paths using multiple lines.


MGN’s picture

Title: Path match: Trivial change for much more power » Path match: (not so) Trivial change for much more power
Status: Active » Postponed

I agree that this could be a useful addition. And on one level it is a trivial change, but not so in the end....

At present, when loading custom breadcrumbs from the database (unless wildcard pattern matching is enabled) the current path is matched against the specific path. The query is common to all the custom breadcrumbs modules and has a single target value. Its easy enough to allow the form to accept and store multiple specific paths per breadcrumb, but the breadcrumb loading function would also have to be re-written, and there would likely be a performance hit to potentially query multiple rather than a single value.

So I am going to mark this as postponed for now, since it will take some work to make the changes and do the performance testing to assess the impact.

bob.hinrichs’s picture

Fair enough, although I am not sure I understand why the query would need to be rewritten, since the module uses Drupal's path pattern matching that already takes multiple lines. In the meantime, in case anyone else needs it, all you need is this form_alter code.

function mymodule_global_form_alter(&$form, $form_state, $form_id) {
  if ($form_id=='custom_breadcrumbs_paths_form'){

However a caveat, and maybe this is what you're referring to: even with this change, the highlighting of the active breadcrumb will not occur if the 'specific path' matches but the path is not found in the paths array. This is what is plaguing me. FYI my use case is I am trying to create a 'step progress' meter. It's not really a breadcrumb and not really a menu, and multiple pages are contained in a single "step" on the bar. It is really something that needs new programming to be done, probably. Maybe a case for a sub-module within CB?

thanks again

MGN’s picture

Status: Postponed » Active

You are right! I forgot that drupal_match_path would accept a list of patterns...

So now, I think the only problem might be with breadcrumbs for a defined language. In _custom_breadcrumbs_paths_page_match($breadcrumb), the language prefix is currently prepended onto the specific path assuming a single path. I suppose it wouldn't take much to insert the language prefix before each pattern...

EDIT: But this would still only work if wildcard matching was enabled - otherwise the query wouldn't pull the proper breadcrumb from the database since it would be trying to equate the current path to a list of paths...

MGN’s picture

Shnapoo’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

New features should go into the head revision to be backported afterwards, shouldn't they?

Thumbs up for this feature request, would make life much easier for me, too.