Additional custom configuration for each variant may be useful for extra tasks which are closely connected to breadcrumbs (setting active menu link is one example). The initial implementation is in the patch which adds hooks which will be implemented by modules which require additional configuration.

Comments

maximpodorov’s picture

The revised patch (drupal_alter() arguments are more proper).

maximpodorov’s picture

The module example - setting the active path for taxonomy menu:

function taxonomy_menu_trail_mutator_path_breadcrumbs_settings_form_custom_alter(&$form, $breadcrumb) {
  $item = (isset($breadcrumb->custom['taxonomy_menu_active_item']) ? $breadcrumb->custom['taxonomy_menu_active_item'] : '');
  $form['taxonomy_menu_form_mutator_active_item'] = array(
    '#title' => 'Active menu link (term ID)',
    '#type' => 'textfield',
    '#default_value' => $item,
  );
}

function taxonomy_menu_trail_mutator_path_breadcrumbs_settings_form_submit_custom_alter(&$custom, $form_state) {
  $custom['taxonomy_menu_active_item'] = (isset($form_state['values']['taxonomy_menu_form_mutator_active_item']) ? $form_state['values']['taxonomy_menu_form_mutator_active_item'] : '');
}

function taxonomy_menu_trail_mutator_path_breadcrumbs_view_alter($breadcrumb, $path_breadcrumb, $contexts) {
  $item = isset($path_breadcrumb->custom['taxonomy_menu_active_item']) ? $path_breadcrumb->custom['taxonomy_menu_active_item'] : '';
  $tid = ctools_context_keyword_substitute($item, array(), $contexts);
  if (($tid) && ($term = taxonomy_term_load($tid))) {
    $path = taxonomy_menu_path_get($term->vid, $term->tid); // This will be changed in the next version of taxonomy_menu.
    menu_tree_set_path('main-menu', $path);
  }
}
maximpodorov’s picture

Any chances to accept this patch? :)

spleshka’s picture

Yes, sure. Thanks for the patch.

Could you please provide example code that uses this feature?

maximpodorov’s picture

The code is in the comment #2. It enables to select a token expression to configure the active menu item if the main menu is generated by Taxonomy Menu module. So you can map any page of the site to the menu item.

spleshka’s picture

Status: Needs review » Closed (fixed)

Ok, I got this idea. Thanks for your patch, commited/pushed to 7.x-3.x.

maximpodorov’s picture

Спасибо, Евгений.

spleshka’s picture

Love your English ;)