Skip to content

Commit

Permalink
Fix an error with invalid field layout data
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Mar 1, 2023
1 parent 82ab689 commit 81df71f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fields/HyperField.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@ private function _normalizeLayoutConfig(array $config = []): array
$layoutConfig = Json::decode($layoutConfig);
}

// Ensure we remove `uid` from the `layoutConfig` - we don't want it
ArrayHelper::remove($layoutConfig, 'uid');

$newLayout = FieldLayout::createFromConfig($layoutConfig);
$fieldLayoutConfig = $newLayout->getConfig();

Expand Down
4 changes: 4 additions & 0 deletions src/services/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use craft\elements\Entry;
use craft\elements\db\ElementQueryInterface;
use craft\events\ConfigEvent;
use craft\helpers\ArrayHelper;
use craft\helpers\ProjectConfig as ProjectConfigHelper;

class Service extends Component
Expand Down Expand Up @@ -91,6 +92,9 @@ public function saveField(array $linkTypes, ?ConfigEvent $event = null): void
continue;
}

// Ensure we remove `uid` from the `layoutConfig` - we don't want it
ArrayHelper::remove($layoutConfig, 'uid');

$fieldLayout = FieldLayout::createFromConfig($layoutConfig);
$fieldLayout->type = $linkType['type'];
$fieldLayout->uid = $layoutUid;
Expand Down

0 comments on commit 81df71f

Please sign in to comment.