If you have a node type that has two child node types, and one of those is set to "hide", the child nodes of the non-hidden content type will display twice.

For example: I have 3 node types, question, answer and note. question can have children from answer and note content types. But, I hide the notes and use a view to display the notes in a block on the right side of the question nodes instead of where relativity displays children. So, when a question is viewed the answers show up twice (after upgrade to the latest version).

I've found the cause and will submit a patch, but first I wanted to ask people which solution is better.

The bug is at line 1544, because the string in the serialized field is "hide" (with quotes) and not hide (without quotes), this if fails
else if ($child_display_option != 'hide') {

so, the solution is either

else if (strpos($child_display_option, 'hide') !== FALSE) {
or
else if ($child_display_option != '"hide"') {

anyone have a preference?

Comments

ericg’s picture

ok, the solution I posted above is *not* the solution to the problem.

the real issue is that in the for each loop starting at line 1537, the value for $children_box gets set and then once it is set it does not get unset, so the loop runs once for every possible child type which then leads to multiple outputs of the children of the non-hidden node type

so, it seems to me that the real fix for this issue is to add in
$children_box="";
after the start of the foreach loop.

will test and then submit a patch

jonhattan’s picture

Status: Active » Fixed

I've fixed it and also refactored the code around.

http://drupalcode.org/project/relativity.git/commit/8506b79

Status: Fixed » Closed (fixed)

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