You are here

protected static function GatherContentPages::sortRecursive in GatherContent 7

Sort page children recursively.

1 call to GatherContentPages::sortRecursive()
GatherContentPages::getPages in ./gathercontent_pages.inc
Get pages from GatherContent for a given project, and order them by parent.

File

./gathercontent_pages.inc, line 99
Class to fetch pages from GatherContent and turn them into Drupal nodes.

Class

GatherContentPages
@file Class to fetch pages from GatherContent and turn them into Drupal nodes.

Code

protected static function sortRecursive($pages, $current = 0) {
  $children = array();
  if (isset($pages[$current])) {
    $children = $pages[$current];
    foreach ($children as $id => $page) {
      $children[$id]->children = GatherContentPages::sortRecursive($pages, $id);
    }
  }
  return $children;
}