public function getDataForEditmode($data, $object = null, $params = [])
{
$fieldData = [];
$metaData = [];
if (!$data instanceof Object\Classificationstore) {
return [];
}
$result = $this->doGetDataForEditMode($data, $object, $fieldData, $metaData, 1);
// replace the real data with the data for the editmode
foreach ($result["data"] as $language => &$groups) {
foreach ($groups as $groupId => &$keys) {
foreach ($keys as $keyId => &$keyValue) {
$keyConfig = Object\Classificationstore\DefinitionCache::get($keyId);
if ($keyConfig->getEnabled()) {
$fd = Object\Classificationstore\Service::getFieldDefinitionFromKeyConfig($keyConfig);
$keyValue = $fd->getDataForEditmode($keyValue, $object, $params);
}
}
}
}
$activeGroupIds = $this->recursiveGetActiveGroupsIds($object);
$validLanguages = $this->getValidLanguages();
foreach ($validLanguages as $language) {
foreach ($activeGroupIds as $groupId => $enabled) {
if (!$enabled) {
continue;
}
$relation = new Object\Classificationstore\KeyGroupRelation\Listing();
$relation->setCondition("type = 'calculatedValue' and groupId = " . $relation->quote($groupId));
$relation = $relation->load();
foreach ($relation as $key) {
$keyId = $key->getKeyId();
$childDef = Object\Classificationstore\Service::getFieldDefinitionFromKeyConfig($key);
$childData = new Object\Data\CalculatedValue($this->getName());
$childData->setContextualData("classificationstore", $this->getName(), null, $language, $groupId, $keyId, $childDef);
$childData = $childDef->getDataForEditmode($childData, $object, $params);
$result["data"][$language][$groupId][$keyId] = $childData;
}
}
}
$result["activeGroups"] = $data->getActiveGroups();
$result["groupCollectionMapping"] = $data->getGroupCollectionMappings();
return $result;
}