public function saveCustomLayoutAction()
{
$customLayout = Object\ClassDefinition\CustomLayout::getById($this->getParam("id"));
$class = Object\ClassDefinition::getById($customLayout->getClassId());
$configuration = \Zend_Json::decode($this->getParam("configuration"));
$values = \Zend_Json::decode($this->getParam("values"));
$modificationDate = intval($values["modificationDate"]);
if ($modificationDate < $customLayout->getModificationDate()) {
$this->_helper->json(["success" => false, "msg" => "custom_layout_changed"]);
}
$configuration["datatype"] = "layout";
$configuration["fieldtype"] = "panel";
$configuration["name"] = "pimcore_root";
try {
$layout = Object\ClassDefinition\Service::generateLayoutTreeFromArray($configuration, true);
$customLayout->setLayoutDefinitions($layout);
$customLayout->setName($values["name"]);
$customLayout->setDescription($values["description"]);
$customLayout->setDefault($values["default"]);
$customLayout->save();
$this->_helper->json(["success" => true, "id" => $customLayout->getId(), "data" => $customLayout]);
} catch (\Exception $e) {
Logger::error($e->getMessage());
$this->_helper->json(["success" => false, "message" => $e->getMessage()]);
}
}