Pimcore\Controller\Action\Admin\Printpage::getDataByIdAction PHP Method

getDataByIdAction() public method

public getDataByIdAction ( )
    public function getDataByIdAction()
    {
        // check for lock
        if (\Pimcore\Model\Element\Editlock::isLocked($this->getParam("id"), "document")) {
            $this->_helper->json(["editlock" => \Pimcore\Model\Element\Editlock::getByElement($this->getParam("id"), "document")]);
        }
        \Pimcore\Model\Element\Editlock::lock($this->getParam("id"), "document");
        $page = Document\Printpage::getById($this->getParam("id"));
        $page = $this->getLatestVersion($page);
        $page->getVersions();
        $page->getScheduledTasks();
        $page->idPath = Service::getIdPath($page);
        $page->userPermissions = $page->getUserPermissions();
        $page->setLocked($page->isLocked());
        if ($page->getContentMasterDocument()) {
            $page->contentMasterDocumentPath = $page->getContentMasterDocument()->getRealFullPath();
        }
        $this->addTranslationsData($page);
        // unset useless data
        $page->setElements(null);
        $page->childs = null;
        // cleanup properties
        $this->minimizeProperties($page);
        //Hook for modifying return value - e.g. for changing permissions based on object data
        //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
        $returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($page));
        \Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $page, "returnValueContainer" => $returnValueContainer]);
        if ($page->isAllowed("view")) {
            $this->_helper->json($returnValueContainer->getData());
        }
        $this->_helper->json(false);
    }