Skip to content

Commit

Permalink
Increment a counter instead of trying to derive the ID from the keyna…
Browse files Browse the repository at this point in the history
…me unless a migration.
  • Loading branch information
spAnser committed May 5, 2017
1 parent 94771ae commit 8fbe180
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion thearchitect/services/TheArchitectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 8fbe180

Please sign in to comment.