Menu Item not created when the content type does not allow children

derjochenmeyer - June 23, 2009 - 17:33
Project:Node Hierarchy
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I created a hierarchy with a regional structure. Simplified here, because my Hierarchy has 6 levels from country (1) to places (6):

Country > Region > Places

Every step represented by its own content type with different CCK field setups.

If i try to create a country it does not show up in the menu thats assigned to the hierarchy UNLESS i enable Country under "Allowed child node types" for Country itself.

Confusing:
- The strange thing is that Countries that are not listet in the custom menu still have (at fist sight) random child nodes.
- Even if the country is not listed in the menu i can add a Region, which then gets listed in the menu (without having regions enabled as children for regions)

#1

derjochenmeyer - June 23, 2009 - 19:09

- NO mlid>nid relationship gets saved to the database in nodehierarchy_menu_links.
- $node->nodehierarchy_old_menu_links AND $node->nodehierarchy_menu_links arrays are missing. Checked with print_r($node) in _nodehierarchy_update_insert_node()

This seems to be the fault of nodehierarchy.module line 317:

function nodehierarchy_nodehierarchy_node_form($node) {
  $form = array();
  // If this node type can be a child.
  if (nodehierarchy_node_can_be_child($node)) {

Why is it neccessary to check "nodehierarchy_node_can_be_child" here. A content type may be used only at the top level.

#2

derjochenmeyer - June 23, 2009 - 19:15
Status:active» needs review

I dont know enough about this module but a working and logical fix is the atached patch for nodehierarchy_nodehierarchy_node_form().

AttachmentSize
nodehierarchy_nodehierarchy_node_form.patch 496 bytes

#3

derjochenmeyer - June 23, 2009 - 19:19
Title:Menu Item not created when the content type does not allow children of its own type» Menu Item not created when the content type does not allow children

Changing the title.

#4

Mr.Alinaki - October 6, 2009 - 22:40

Thanks for the patch! I have unpredictable menu creation before with 2.x, but that patch have to solve my problem.

 
 

Drupal is a registered trademark of Dries Buytaert.