You are here

public function ViewsEFFieldsetTree::__construct in Views Exposed Form Fieldset 7.2

File

includes/tree.inc, line 8

Class

ViewsEFFieldsetTree

Code

public function __construct(array $items) {
  $index = $this
    ->createIndex($items);
  $orphans = array();
  $tree =& $this
    ->createTree($index, $orphans);
  $comparator = new ViewsEFFieldsetComparator('weight', ViewsEFFieldsetComparator::NULL_SORT_LAST);
  $sort_callback = $comparator
    ->getCallback();

  // Sort children.
  foreach ($index as &$item) {
    uasort($item['children'], $sort_callback);
  }

  // Sort root items.
  uasort($tree, $sort_callback);
  uasort($orphans, $sort_callback);
  $tree += $orphans;
  $this
    ->setWeights($tree, TRUE);
  $this
    ->setDepth($tree);
  $this->tree = $tree;
}