- nodefamily_relation_load_siblings in contributions/nodefamily/nodefamily.module
- Load all siblings for a node. The sibling nodes will be loaded into the array $node->siblings and grouped by their parent.
nodefamily_relation_load_siblings(&$node, $status = 1)Load all siblings for a node. The sibling nodes will be loaded into the array $node->siblings and grouped by their parent.
$node The node object or the node's id
$status The minimum status value a node must have to be included. Use 0 for all nodes.
contributions/nodefamily/nodefamily.module, line 655
<?php
function nodefamily_relation_load_siblings(&$node, $status = 1) {
if (!is_object($node)) {
//$node is the nid
$node2 = node_load($node);
return is_object($node2) ? nodefamily_relation_load_siblings($node2, $status) : FALSE;
}
//load the parents
nodefamily_relation_load_parents($node, $status);
$node->siblings = array();
// find and load the children of the parents
foreach ($node->parents as $parent) {
$children = nodefamily_relation_load($parent->nid, $status);
foreach ($children as $child) {
// don't include current node in list of siblings
if ($child->nid != $node->nid) {
$node->siblings[][] = $child;
}
}
}
return $node->siblings;
}
?>