Xpressengine\Menu\MenuHandler::setHierarchy PHP Method

setHierarchy() protected method

Set hierarchy information for new item
protected setHierarchy ( MenuItem $item ) : void
$item Xpressengine\Menu\Models\MenuItem item object
return void
    protected function setHierarchy(MenuItem $item)
    {
        // 이미 존재하는 경우 hierarchy 정보를 새로 등록하지 않음
        try {
            $item->ancestors()->attach($item->getKey(), [$item->getDepthName() => 0]);
        } catch (\Exception $e) {
            return;
        }
        if ($item->{$item->getParentIdName()}) {
            $parent = $this->repo->findItem($item->{$item->getParentIdName()});
            $this->linkHierarchy($item, $parent);
        }
    }