public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
}
Element\Editlock::lock($this->getParam("id"), "document");
$link = Document\Hardlink::getById($this->getParam("id"));
$link = clone $link;
$link->idPath = Element\Service::getIdPath($link);
$link->userPermissions = $link->getUserPermissions();
$link->setLocked($link->isLocked());
$link->setParent(null);
if ($link->getSourceDocument()) {
$link->sourcePath = $link->getSourceDocument()->getRealFullPath();
}
$this->addTranslationsData($link);
$this->minimizeProperties($link);
//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($link));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $link, "returnValueContainer" => $returnValueContainer]);
if ($link->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(false);
}