You are here

private function ViewsEFFieldsetData::parseTree in Views Exposed Form Fieldset 7

Parameters

array $elements:

string $parentId:

int $depth:

Return value

array

1 call to ViewsEFFieldsetData::parseTree()
ViewsEFFieldsetData::buildTreeData in includes/ViewsEFFieldsetData.php

File

includes/ViewsEFFieldsetData.php, line 39
ViewsEFFieldsetData class file.

Class

ViewsEFFieldsetData
Class ViewsEFFieldsetData

Code

private function parseTree(array &$elements, $rootParentID = '') {
  $branch = array();
  foreach ($elements as $key => $element) {
    if ($element['pid'] != $rootParentID) {
      continue;
    }
    $branch[] = array(
      'item' => $element,
      'children' => $this
        ->parseTree($elements, $element['id']),
    );
  }

  // Automatically get sorted results.
  usort($branch, array(
    $this,
    'sortByWeight',
  ));
  return empty($branch) ? array() : $branch;
}