=== modified file 'composite/composite.module' --- composite/composite.module 2010-03-25 04:58:28 +0000 +++ composite/composite.module 2010-04-20 04:57:56 +0000 @@ -493,35 +493,42 @@ // for other modules to do their processing first. $layout = composite_get_layout($node->composite_layout); if ($layout) { - $layout['data'] = $node->composite_layout_data; - $node->composite_content = composite_view($node, $layout, $node->composite_references); - foreach ($node->composite_content as $zone => $zone_item) { - $node->composite_content[$zone] = drupal_render($zone_item); - } - - // Add this layout's css, if any - if ($layout['css']) { - drupal_add_css($layout['css']); - } - - // Call the appropriate theme('composite_layout...', ...) function. - // However, because the number of arguments depends on the number - // of zones in the layout layout, we have to use call_user_func_array - - // Add in the theme hook name and the first two arguments - $args = array( - 'composite_layout_' . $layout['key'], // theme hook - $layout, // layout - $node->composite_content // composite_content - ); - - // Now add an argument for the contents of each zone - foreach ($layout['zones'] as $zone => $unused) { - $args[] = $node->composite_content[$zone]; - } - - // And call it - $node->body = call_user_func_array('theme', $args); + + // Check for infinite loops + if (_composite_nodes_recursion_check($node)) { + drupal_set_message(t('You have created an infinite loop. One node is displaying a second node which in turn displays the first node.'), 'error'); + } + else { + $layout['data'] = $node->composite_layout_data; + $node->composite_content = composite_view($node, $layout, $node->composite_references); + foreach ($node->composite_content as $zone => $zone_item) { + $node->composite_content[$zone] = drupal_render($zone_item); + } + + // Add this layout's css, if any + if ($layout['css']) { + drupal_add_css($layout['css']); + } + + // Call the appropriate theme('composite_layout...', ...) function. + // However, because the number of arguments depends on the number + // of zones in the layout layout, we have to use call_user_func_array + + // Add in the theme hook name and the first two arguments + $args = array( + 'composite_layout_' . $layout['key'], // theme hook + $layout, // layout + $node->composite_content // composite_content + ); + + // Now add an argument for the contents of each zone + foreach ($layout['zones'] as $zone => $unused) { + $args[] = $node->composite_content[$zone]; + } + + // And call it + $node->body = call_user_func_array('theme', $args); + } } } break; @@ -660,6 +667,19 @@ return $composite_content; } +// Returns true if there is an infinite loop. +function _composite_nodes_recursion_check($node) { + static $nodes = array(); + + if (array_key_exists($node->nid, $nodes)) { + return true; + } + else { + $nodes[$node->nid] = $node->nid; + return false; + } +} + /*********************************************************** * COMPOSITE LAYOUT SETS * ************************************************************/ === modified file 'composite/composite.node.inc' --- composite/composite.node.inc 2010-03-25 04:05:20 +0000 +++ composite/composite.node.inc 2010-04-20 04:57:48 +0000 @@ -47,13 +47,7 @@ break; case 'full': - if (_composite_nodes_recursion_check($node)) { - drupal_set_message(t('You have created an infinite loop. One node is displaying a second node which in turn displays the first node.'), 'error'); - $output = node_view($node, TRUE, FALSE); - } - else { - $output = node_view($node, FALSE, FALSE); - } + $output = node_view($node, FALSE, FALSE); break; } return $output; @@ -138,16 +132,3 @@ return array(); } } - -// Returns true if we there is an infinite loop. -function _composite_nodes_recursion_check($node) { - static $nodes = array(); - - if (array_key_exists($node->nid, $nodes)) { - return true; - } - else { - $nodes[$node->nid] = $node->nid; - return false; - } -}