Skip to content

Commit

Permalink
Add extra error logging for Matrix and Super Table fields for Typed L…
Browse files Browse the repository at this point in the history
…ink field migration
  • Loading branch information
engram-design committed Aug 23, 2024
1 parent 50f4d40 commit 21c54dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/migrations/MigrateTypedLinkField.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ public function processFieldSettings(): void
// Check for blocktype errors too
foreach ($matrixField->getBlockTypes() as $blockType) {
$errors[$blockType->handle] = $blockType->getErrors();

if ($fieldLayout = $blockType->getFieldLayout()) {
foreach ($fieldLayout->getCustomFields() as $blockTypeField) {
$errors[$blockType->handle . '_' . $blockTypeField->handle] = $blockTypeField->getErrors();
}
}
}

throw new Exception(Json::encode(array_filter($errors)));
Expand Down Expand Up @@ -191,6 +197,12 @@ public function processFieldSettings(): void
// Check for blocktype errors too
foreach ($superTableField->getBlockTypes() as $blockType) {
$errors[] = $blockType->getErrors();

if ($fieldLayout = $blockType->getFieldLayout()) {
foreach ($fieldLayout->getCustomFields() as $blockTypeField) {
$errors[$blockType->handle . '_' . $blockTypeField->handle] = $blockTypeField->getErrors();
}
}
}

throw new Exception(Json::encode(array_filter($errors)));
Expand Down

0 comments on commit 21c54dd

Please sign in to comment.