I couldn't get the breadcrumb trails (menu) to work with my pages / stories that I structure with node relativity (a Drupal module). I don't know if I'm doing something wrong, but looking at the code, I couldn't see any support for it. So, here it is, a quick and dirty hack to add the breadcrumb trails to your node relativity structures:
--- relativity.module-2.4 2008-09-17 19:44:07.000000000 -0700
+++ relativity.module 2008-09-18 07:49:10.000000000 -0700
@@ -378,6 +378,14 @@
'#title' => t('Global Options'),
);
+ $group['global_options']['relativity_breadcrumb_trails'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Update the breadcrumb trails menu'),
+ '#return_value' => 1,
+ '#default_value' => variable_get('relativity_breadcrumb_trails', 0),
+ '#description' => t('If checked, the ancestor hiearchy of the page is used to create the breadcrumb trail menu.'),
+ );
+
$group['global_options']['relativity_allow_types'] = array(
'#type' => 'select',
'#title' => t('Node types that can be involved in relationships'),
@@ -1067,13 +1075,35 @@
break;
case 'view':
- if ($w = variable_get('relativity_'.$node->type.'_ancestor_weight', 0)) {
+ $do_breadcrumbs = variable_get('relativity_breadcrumb_trails', FALSE);
+ $ancestors_w = variable_get('relativity_'.$node->type.'_ancestor_weight', 0);
+
+ if ($do_breadcrumbs || $ancestors_w) {
$ancestors = relativity_load_ancestors($node);
+
if (is_array($ancestors) && count($ancestors) > 0) {
- $node->content['relativity_ancestors'] = array(
- '#value' => theme('relativity_show_ancestors', $node, $ancestors),
- '#weight' => $w,
- );
+ if ($do_breadcrumbs) {
+ $breadcrumb[] = l(t('Home'), NULL);
+ foreach($ancestors as $ancestor) {
+ if (!is_array($ancestor)) { // Only handle single ancestors here
+ if (array_key_exists("path", $ancestor)) {
+ $breadcrumb[] = l($ancestor->title, $ancestor->path);
+ } else {
+ $breadcrumb[] = l($ancestor->title, 'node/'. $ancestor->nid);
+ }
+ }
+ }
+ if (count($breadcrumb) > 1) {
+ drupal_set_breadcrumb($breadcrumb);
+ }
+ }
+
+ if ($ancestors_w) {
+ $node->content['relativity_ancestors'] = array(
+ '#value' => theme('relativity_show_ancestors', $node, $ancestors),
+ '#weight' => $ancestors_w,
+ );
+ }
}
}
And yes, I did file a "issue" for this, with the Drupal people, http://drupal.org/node/309982 .