function _draggableviews_compare_nodes in DraggableViews 7
Same name and namespace in other branches
- 6.3 draggableviews.inc \_draggableviews_compare_nodes()
Compare Nodes (used by uasort)
Parameters
$node1:
$node2:
Return value
< or > or ==
1 string reference to '_draggableviews_compare_nodes'
- _draggableviews_sort_nodes in ./
draggableviews.inc - Sort Nodes
File
- ./
draggableviews.inc, line 1077 - Draggableviews processing functions. Rough summary of what functions in this file do:
Code
function _draggableviews_compare_nodes($node1, $node2) {
// The first difference will be significant. If they equal in each level we
// "survive" the loop and end up with return 0.
for ($i = 0; $i < count($node1['order']); $i++) {
if (isset($node1['order'][$i]) && isset($node2['order'][$i])) {
if ($node1['order'][$i] < $node2['order'][$i]) {
return -1;
}
if ($node1['order'][$i] > $node2['order'][$i]) {
return 1;
}
}
}
return 0;
}