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");
$email = Document\Newsletter::getById($this->getParam("id"));
$email = clone $email;
$email = $this->getLatestVersion($email);
$versions = Element\Service::getSafeVersionInfo($email->getVersions());
$email->setVersions(array_splice($versions, 0, 1));
$email->idPath = Element\Service::getIdPath($email);
$email->userPermissions = $email->getUserPermissions();
$email->setLocked($email->isLocked());
$email->setParent(null);
// unset useless data
$email->setElements(null);
$email->childs = null;
$this->addTranslationsData($email);
$this->minimizeProperties($email);
//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($email));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $email, "returnValueContainer" => $returnValueContainer]);
if ($email->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(false);
}