Pimcore\Controller\Action\Admin\Element::treeGetRootAction PHP Method

treeGetRootAction() public method

public treeGetRootAction ( )
    public function treeGetRootAction()
    {
        $type = $this->getParam("controller");
        $allowedTypes = ["asset", "document", "object"];
        $id = 1;
        if ($this->getParam("id")) {
            $id = intval($this->getParam("id"));
        }
        if (in_array($type, $allowedTypes)) {
            $root = Model\Element\Service::getElementById($type, $id);
            if ($root->isAllowed("list")) {
                $this->_helper->json($this->getTreeNodeConfig($root));
            }
        }
        $this->_helper->json(["success" => false, "message" => "missing_permission"]);
    }