function nodehierarchy_views_embed_children in Node Hierarchy 6.3
Same name and namespace in other branches
- 5 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_embed_children()
- 6 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_embed_children()
- 6.2 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_embed_children()
- 7.4 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_embed_children()
- 7.2 nodehierarchy_views/nodehierarchy_views.module \nodehierarchy_views_embed_children()
Add the embedded children view to the node body if appropriate.
1 call to nodehierarchy_views_embed_children()
- nodehierarchy_views_nodeapi in nodehierarchy_views/
nodehierarchy_views.module - Implementation of hook_nodeapi().
File
- nodehierarchy_views/
nodehierarchy_views.module, line 174 - Embed a view of children onto a node.
Code
function nodehierarchy_views_embed_children(&$node) {
$display = @$node->nh_children_view_display ? @$node->nh_children_view_display : 'default';
// Get the arguments to send to the view. This should allow other view arguments to still work.
$arguments = explode('/', $_GET['q']);
// First arg will be 'node', the second will be the node id. Remove them.
array_shift($arguments);
array_shift($arguments);
// Add the node id of the given node.
array_unshift($arguments, $node->nid);
// Defer the rendering of the view until the theme function so it can be overriden or altered.
$node->content['nodehierarchy_children'] = array(
'#type' => 'nodehiararchy_children_embed',
'#nodehierarchy_view' => $node->nh_children_view,
'#nodehierarchy_view_display' => @$node->nh_children_view_display ? @$node->nh_children_view_display : 'default',
'#nodehierarchy_view_args' => $arguments,
'#weight' => function_exists('content_extra_field_weight') ? content_extra_field_weight($type, 'nodehierarchy_children') : 10,
);
$node->content['nodehierarchy_children_links'] = array(
"#value" => theme('nodehierarchy_new_child_links', $node),
"#weight" => function_exists('content_extra_field_weight') ? content_extra_field_weight($type, 'nodehierarchy_children_links') : 11,
);
}