Token values not generated for nodes without menu item

sun - February 2, 2009 - 18:24
Project:Menu Trails
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:sun
Status:closed
Description

If a node does not have a menu item, no token value is generated in menutrails_token_values(), which means that the token is empty for such nodes when used in pathauto.

AttachmentSize
menutrails-DRUPAL-6--1.content-type-menu-tokens.patch711 bytes

#1

smithn.nc - February 17, 2009 - 20:53

Hi! I've patched my copy of menu trails, and I'm still running into the problem of nodes without menu items not getting a token. Menu trails is working otherwise; when viewing the node, the menu is active and the breadcrumbs are set.
Edit:
I've narrowed it down a little more. It seems that menu trails settings based on node types correctly generate tokens with your patch, while those based on taxonomy do not. I set menu trails to get the path based on node type, and the token worked. I then changed it back how I had it, with a taxonomy term setting menu trail. While breadcrumb and menu trail worked with the term based trail, the token didn't any more.

#2

smithn.nc - February 17, 2009 - 22:03

Alright. I figured out what was going on... sort-of. In the function menutrails_node_location, terms are checked to be in the array $term_trails. It was failing because of the three terms, two were strings and one was an array. Then when menutrails_node_location tried to use $term->tid in a check, it wasn't applicable.

On another note, why is this the case? It doesn't make sense that some terms in $node->taxonomy would be arrays and others not.

Anyway, I rolled a patch including my change along with the original fix. If I've done something that doesn't make sense, please let me know, but it does fix things over here. Taxonomy based menu trails now give tokens as they should.

AttachmentSize
menutrails-DRUPAL-6--1.tokens-with-taxonomy.patch 1.01 KB

#3

qbnflaco - May 9, 2009 - 04:34

I applied this patch and term pathauto still doesn't seem to work for me. Is there anything special I have to do after applying patch, deleting all content aliases and generating them again?

#4

sun - July 24, 2009 - 17:28
Status:needs review» fixed

@smithn.nc: I think your addition to this patch is a different bug/issue. Please search the issue queue for already existing issues, and if there is none, feel free to create a new one. However, $term should always be an array, so I don't know whether that makes sense at all. Most probably a third-party contrib module is hi-jacking $node->taxonomy on your site.

Thanks for reporting, reviewing, and testing! Committed to 6.x.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

#5

brian_c - July 29, 2009 - 03:46

I had the same problem @smithn.nc was having; menutrails based on taxonomies weren't generating tokens for autopath.

I applied the patch to menutrails_node_location() from #2 and it fixed the problem for me as well.

#6

System Message - August 12, 2009 - 03:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.