function nodehierarchy_get_node_children_list in Node Hierarchy 6
Same name and namespace in other branches
- 5 nodehierarchy.module \nodehierarchy_get_node_children_list()
Display a list of nodes with nodehierarchy actions.
2 calls to nodehierarchy_get_node_children_list()
- nodehierarchy_callback_ajax in ./
nodehierarchy.module - Ajax callback.
- _nodehierarchy_display_children_list in ./
nodehierarchy.module - Get the children list of the given node.
File
- ./
nodehierarchy.module, line 680
Code
function nodehierarchy_get_node_children_list($nid, $expandable = FALSE, $pager = FALSE) {
$rows = array();
$children = nodehierarchy_get_children($nid, $pager);
foreach ($children as $child) {
$node = node_load($child);
if (node_access('view', $node)) {
$item_expandable = $expandable && variable_get('nh_parent_' . $node->type, FALSE);
$expanded = $item_expandable && _nodehierarhcy_is_expanded($node->nid);
$url = $item_expandable ? _nodehierarchy_toggle_expand_url($node->nid) : url("node/" . $node->nid);
$children = $expanded ? nodehierarchy_get_node_children_list($node->nid, $expandable) : array();
$tooltip = t('@title (Type: @type)', array(
'@title' => $node->title,
"@type" => node_get_types('name', $node),
));
$tooltip .= $item_expandable ? ' ' . t('Click to toggle children.') : ' ' . t('Click to view.');
$rows[] = array(
"node" => $node,
"url" => $url,
"expandable" => $item_expandable,
"expanded" => $expanded,
"children" => $children,
"tooltip" => $tooltip,
);
}
}
return $rows;
}