widgets/PageTreeWidget.php
private function renderTree($parentId = 0)
    {
        $query = Page::find();
        $query->andWhere(['deleted' => 0, 'revision_to' => 0, 'parent_id' => $parentId]);
        $query->orderBy('title ASC');

        if (($pages = $query->all()) == null) {
            //empty array if no data found
            return [];
        }

        $tree = $this->getBranch($pages, true);

        return $tree;
    }
private function renderTree($parentId = 0)
    {
        $query = Page::find();
        $query->andWhere(['deleted' => 0, 'revision_to' => 0, 'parent_id' => $parentId]);
        $query->orderBy('title ASC');

        if (($pages = $query->all()) == null) {
            //empty array if no data found
            return [];
        }

        $tree = $this->getBranch($pages, true);

        return $tree;
    }
Returns hierarchical data of pages
@param int $parentId
@return array