protected function toList(array $items = [], $level = 0)
    {
        $prefix = str_repeat('&nbsp;&nbsp;', $level);

        $pages = [];

        foreach ($items as $item) {
            $pages[$item['id']] = $prefix . '' . $item['title'];

            if ($item['children']) {
                $pages += $this->toList($item['children'], $level + 1);
            }
        }

        return $pages;
    }
protected function toList(array $items = [], $level = 0)
    {
        $prefix = str_repeat('&nbsp;&nbsp;', $level);

        $pages = [];

        foreach ($items as $item) {
            $pages[$item['id']] = $prefix . '' . $item['title'];

            if ($item['children']) {
                $pages += $this->toList($item['children'], $level + 1);
            }
        }

        return $pages;
    }
protected function toList ( array $ items = [ ] , $ level = 0 ) { $ prefix = str_repeat ( '&nbsp;&nbsp;' , $ level ) ; $ pages = [ ] ; foreach ( $ items as $ item ) { $ pages [ $ item [ 'id' ] ] = $ prefix . '' . $ item [ 'title' ] ; if ( $ item [ 'children' ] ) { $ pages += $ this -> toList ( $ item [ 'children' ] , $ level + 1 ) ; } } return $ pages ; }
Transform tree to list

@param $items
@param int $level
@return array
Transform tree to list