I have recently done something like this in one of my own modules:

    if ($node->type == 'page' && function_exists('menu_breadcrumb_init')) {
      // Since menu_breadcrumb does not expose their API, we’ll have to 
      // resort monkeypatching the $conf array before re-running their 
      // init function.
      global $conf;
      $previous_value = variable_get('menu_breadcrumb_determine_menu');

      $conf['menu_breadcrumb_determine_menu'] = 1;
      menu_breadcrumb_init();

      // Revert to the previous value, unsetting if variable_get returned 
      // NULL, meaning there was no previous value.
      if (is_null($previous_value)) {
        unset($conf['menu_breadcrumb_determine_menu']);
      }
      else {
        $conf['menu_breadcrumb_determine_menu'] = $previous_value;
      }
    }

It would be nice if you could disable menu_breadcrumb completely and then only invoke it from your own code, since it might not always be applicable to the whole site.

Comments

grendzy’s picture

One problem might be that menu_set_item doesn't work everywhere (hook_init seems to be the only really reliable place). See #520106: Allow setting the active menu trail for dynamically-generated menu paths.

xurizaemon’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Cleaning up issue queue. Closing all D6 issues.

If you believe this issue still applies to a supported version, feel free to re-open it. That would be a great time to check if the issue contains clear steps for reproducing the bug!

Thanks and sorry for any inconvenience.