public function getDataFromEditmode($data, $object = null, $params = [])
{
$values = [];
$count = 0;
if (is_array($data)) {
foreach ($data as $collectionRaw) {
$collectionData = [];
$collectionKey = $collectionRaw["type"];
$oIndex = $collectionRaw["oIndex"];
$collectionDef = Object\Fieldcollection\Definition::getByKey($collectionKey);
$fieldname = $this->getName();
foreach ($collectionDef->getFieldDefinitions() as $fd) {
if (array_key_exists($fd->getName(), $collectionRaw["data"])) {
$collectionData[$fd->getName()] = $fd->getDataFromEditmode($collectionRaw["data"][$fd->getName()], $object, ["context" => ["containerType" => "fieldcollection", "containerKey" => $collectionKey, "fieldname" => $fieldname, "index" => $count, "oIndex" => $oIndex]]);
}
}
$collectionClass = "\\Pimcore\\Model\\Object\\Fieldcollection\\Data\\" . ucfirst($collectionRaw["type"]);
$collection = new $collectionClass();
$collection->setValues($collectionData);
$collection->setIndex($count);
$collection->setFieldname($this->getName());
$values[] = $collection;
$count++;
}
}
$container = new Object\Fieldcollection($values, $this->getName());
return $container;
}