You are here

protected function TreeHelper::groupResultByParent in Views tree 8.2

Groups results by parent.

Parameters

array $result: The result set.

Return value

array Result grouped by parent.

1 call to TreeHelper::groupResultByParent()
TreeHelper::getTreeFromResult in src/TreeHelper.php
Builds a tree from a views result.

File

src/TreeHelper.php, line 106

Class

TreeHelper
The tree helper service.

Namespace

Drupal\views_tree

Code

protected function groupResultByParent(array $result) {
  $return = [];
  foreach ($result as $row) {
    $return[$row->views_tree_parent][] = $row;
  }
  return $return;
}