Hey,

I just found a little bug that occurs when a parent has no url_alias when I was trying to adjust NH to the category module (so it doesn't include hidden containers in breadcrumbs and url_aliases).

In the file nodehierarchy_token.inc on ~ line 39 it says:

    else {
      // recurse
      return nodehierarchy_token_get_<strong>full</strong>hierarchypath(node_load($node->parent));
    }

Since in that very function it says:

  return trim(nodehierarchy_token_get_hierarchypath($node) ."/". $node->title, "/");

the recursion will always add the title of the respective parent node to the end of the url_alias and not the title of the node about to be created. I'm sure this happens with every "regular" recursion (when parent url_alias is missing) and not just in my case (where parent is a hidden container).

Solution: call the function nodehierarchy_token_get_hierarchypath instead and the original $node->title won't be affected.
so nodehierarchy_token.inc, ~ line 39 says:

    else {
      // recurse
      return nodehierarchy_token_get_hierarchypath(node_load($node->parent));
    }

This is also the function that gets called by nodehierarchy_token_get_fullhierarchypath in the first place, so recursion should continue with that function anyway.

Maybe someone can fix this for a future release :-).

Stefan

Comments

markhalliwell’s picture

Component: Code » Drupal/PHP Code

Copy & Pasted: This issue pertains to the 6.x-1.x branch which is now legacy and is over two years old. If this issue is not applicable anymore, please consider closing it. Otherwise, please update this issue appropriately. Will be closed in two weeks if no response.