private function ViewsEFFieldsetData::parseTree in Views Exposed Form Fieldset 8
Parse the tree.
Parameters
array $elements: The elements.
string $rootParentID: The root parent ID.
int $depth: The depth.
Return value
array The array.
1 call to ViewsEFFieldsetData::parseTree()
- ViewsEFFieldsetData::buildTreeData in src/ViewsEFFieldsetData.php 
- Built the tree data.
File
- src/ViewsEFFieldsetData.php, line 108 
Class
- ViewsEFFieldsetData
- Class ViewsEFFieldsetData.
Namespace
Drupal\views_ef_fieldsetCode
private function parseTree(array &$elements, $rootParentID = '', $depth = -1) {
  $branch = [];
  $depth++;
  foreach ($elements as $key => $element) {
    $element['depth'] = $depth;
    if ($element['pid'] !== $rootParentID) {
      continue;
    }
    $branch[] = [
      'item' => $element,
      'children' => $this
        ->parseTree($elements, $element['id'], $depth),
    ];
  }
  // Automatically get sorted results.
  usort($branch, [
    $this,
    'sortByWeight',
  ]);
  return empty($branch) ? [] : $branch;
}