Skip to content

Commit

Permalink
Merge branch 'hotfix/v1.6.0-beta.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
spAnser committed May 5, 2017
2 parents 1dd18d6 + d3ba172 commit a3fed0d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
[{
"version": "1.6.0-beta.5",
"downloadUrl": "https://github.com/Pennebaker/craftcms-thearchitect/archive/v1.6.0-beta.5.zip",
"date": "2017-05-05T10:41:16-05:00",
"notes": [
"[Fixed] Neo valid field layout detection fixed."
]
}, {
"version": "1.6.0-beta.4",
"downloadUrl": "https://github.com/Pennebaker/craftcms-thearchitect/archive/v1.6.0-beta.4.zip",
"date": "2017-04-26T13:17:32-05:00",
Expand Down
12 changes: 10 additions & 2 deletions 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 Expand Up @@ -1429,7 +1434,10 @@ private function checkFieldLayout($fieldLayout)
foreach ($fields as $fieldHandle) {
$field = craft()->fields->getFieldByHandle($fieldHandle);
if ($field === null) {
array_push($problemFields['handle'], 'Handle "'.$fieldHandle.'" is not a valid field.');
$field = craft()->fields->getFieldById($fieldHandle);
if ($field === null) {
array_push($problemFields['handle'], 'Handle "'.$fieldHandle.'" is not a valid field.');
}
}
}
}
Expand Down

0 comments on commit a3fed0d

Please sign in to comment.