1

I am using the Path Breadcrumbs module to create breadcrumbs. I don't fully understand how to use arguments and selection rules, and thus I'm not sure how to create the following breadcrumb:

On the gallery node page (/gallery/%node), I want the following breadcrumb:

home>events>[event-name]>schedule

Every Event node contains a node reference to a gallery node, and I am trying to add this event name to the breadcrumb. I already have retrieved the event name into the $variables variable (following this how to retrieve referring node data from inside a template file), if that helps.

0

As an last option you can implement theme_breadcrumb() in your theme template.php

Something like below sample code.

function themename_breadcrumb($variables) {
  if (arg(0) == "galery" && is_numeric(arg(1))) {

    // Get event title of the  event
    $event_nids = mymodulename_get_back_refernce_value(arg(1));

    // Note since a gallery can be referred by multiple event nodes so you have add logic which one you need to pick here, for now I am picking with array index as 0
    $event_node = node_load($events_nids[0]);

    $links[0] = l(t('Home'), '<front>');

   // inplace of 'events' add internal link path to events page.
    $links[1] = l(t('Events'),'events');
    $links[2] = l(t($event_node->title),'node/'.$event_node->nid);
    $links[3] = t('schedule');
    drupal_set_breadcrumb($links);
  }
}
  • I tried your code, with a few changes - if (arg(0) == "gallery") - and - $event_nids = get_back_reference_value($variables['node']->nid); but nothing happened. I changed the name to my theme name and flushed the cache, but I don't think the code is ever being picked up. I tried a drupal_set_message and it never displayed either. – user1015214 Oct 15 '13 at 15:41
  • do you have devel installed? – arpitr Oct 15 '13 at 16:07
  • @user1015214 can you join this chat room chat.stackexchange.com/rooms/11070/breadcrumb – arpitr Oct 15 '13 at 16:15
0

Path Breadcrumbs module works with system paths. For nodes system path looks like node/%. You can read more in module FAQ and docs.

The main problem with your example is that your Gallery content type doesn't have reference field to Event.
So other modules don't know if this Gallery node is referenced to that Event node.
Where are a list of modules which may help with it (wasn't tested by me): How to implement two way node references?

Another way is to provide computed entity property "Event" for Gallery content type with Entity API (hook_entity_property_info_alter). After that your propery will be avalible as a token in Path Breadcrumbs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.