Needs review
Project:
Node Hierarchy
Version:
7.x-2.x-dev
Component:
Drupal/PHP Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Mar 2013 at 23:01 UTC
Updated:
13 Sep 2014 at 06:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
solvita commentedHere's a patch that removes the node and its descendants from the menu tree. Seems to work for me. Deals only with display, not validation when node is saved.
Comment #2
garret.gengler commentedI noticed the same issue, but I found a different fix... maybe I'm missing something though, or we were working against different versions.
In the latest 7.x dev code:
The if clause that checks ancestor nids only gets checked if the selected node is disabled (as a NH type).
I think it needs to be re-arranged like this:
In my testing, this fixes the problem. Now, if you try to change a node's parent, and select the node or any of it's children, you get a clean error message.
I have attached a patch.
Comment #3
roderikSeems to me like both #1 and #2 should be added to the module. The validation should definitely be fixed, but I don't see a reason for _nodehierarchy_tree_data() to return and display an 'un-choosable' node either.
Credit to solvita/garret.gengler; I just packed the two together (and got rid of the '@' in the validate function which I'm sure is against coding standards).
Comment #4
roderikWait, The patch in #1 needed some additions, IMHO:
nodehierarchy_get_node_ancestor_nids()is even called, if you are excluding the current node and its children from the tree anyway. (There is a reason, and it's commented now. Also, I split out the two 'if' conditions over two lines. That's partly just taste/readability.)nodehierarchy_get_node_ancestor_nids()being called in a loop like this.This patch needs #2335219: Reduce database queries by caching data applied first. If you really don't want to do that, you can delete the 2nd hunk from the patch / the following two lines from the patched code:
Comment #5
roderikI was still getting some invalid nodes in the list. See interdiff.
(This is not related to the original issue per se, but I just have too many needs-review patches to create a new issue for this...)