public function bulkImportAction()
{
$result = [];
$tmpName = $_FILES["Filedata"]["tmp_name"];
$json = file_get_contents($tmpName);
$tmpName = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/bulk-import.tmp";
file_put_contents($tmpName, $json);
$json = json_decode($json, true);
foreach ($json as $groupName => $group) {
foreach ($group as $groupItem) {
$displayName = null;
if ($groupName == "class") {
$name = $groupItem["name"];
$icon = \Pimcore\Tool\Admin::isExtJS6() ? "class" : "database_gear";
} elseif ($groupName == "customlayout") {
$className = $groupItem["className"];
$layoutData = ["className" => $className, "name" => $groupItem["name"]];
$name = serialize($layoutData);
$displayName = $className . " / " . $groupItem["name"];
$icon = "database_lightning";
} else {
if ($groupName == "objectbrick") {
$icon = \Pimcore\Tool\Admin::isExtJS6() ? "objectbricks" : "bricks";
} elseif ($groupName == "fieldcollection") {
$icon = \Pimcore\Tool\Admin::isExtJS6() ? "fieldcollection" : "table_multiple";
}
$name = $groupItem["key"];
}
if (!$displayName) {
$displayName = $name;
}
$result[] = ["icon" => $icon, "checked" => true, "type" => $groupName, "name" => $name, "displayName" => $displayName];
}
}
$this->_helper->json(["success" => true, "filename" => $tmpName, "data" => $result], false);
$this->getResponse()->setHeader("Content-Type", "text/html");
}