diff --git a/thearchitect/services/TheArchitectService.php b/thearchitect/services/TheArchitectService.php index 5d6dc4c..5b2fe99 100644 --- a/thearchitect/services/TheArchitectService.php +++ b/thearchitect/services/TheArchitectService.php @@ -298,9 +298,13 @@ public function parseJson($json, $migration = false, $force = false) if ($field->type == 'Neo' && $addFieldResult[0]) { $generatedField = $addFieldResult[3]; $blockTypes = craft()->neo->getBlockTypesByFieldId($generatedField->id); + $blockTypeKey = 0; foreach ($field->typesettings['blockTypes'] as $key => $value) { - $blockTypeKey = intval(substr($key, 3)); + if ($migration) { + $blockTypeKey = intval(substr($key, 3)); + } $fieldLayoutId = $blockTypes[$blockTypeKey]->getFieldLayout()->id; + $blockTypeKey++; if (craft()->plugins->getPlugin('relabel')) { if (isset($value['relabel'])) { foreach ($value['relabel'] as $relabel) { @@ -1085,6 +1089,7 @@ public function addField($jsonField, $fieldID = false) if (!isset($blockType->maxChildBlocks)) { $blockType->maxChildBlocks = ''; } + $problemFields = $this->checkFieldLayout($blockType->fieldLayout); if ($problemFields !== ['handle' => []]) { return [false, $problemFields, false, false];