skeeks\cms\cmsWidgets\contentElements\ContentElementsCmsWidget::getAllIdsForChildren PHP Метод

getAllIdsForChildren() публичный Метод

public getAllIdsForChildren ( Tree $tree ) : array
$tree skeeks\cms\models\Tree
Результат array
    public function getAllIdsForChildren(Tree $tree)
    {
        $treeIds = [];
        /**
         * @var $query ActiveQuery
         */
        $childrens = $tree->getChildren()->with('children')->all();
        if ($childrens) {
            foreach ($childrens as $chidren) {
                if ($chidren->children) {
                    $treeIds[$chidren->id] = $chidren->id;
                    $treeIds = array_merge($treeIds, $this->getAllIdsForChildren($chidren));
                } else {
                    $treeIds[$chidren->id] = $chidren->id;
                }
            }
        }
        return $treeIds;
    }