diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d8fb79..eec008a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added - Added ability to [track views](https://plugins.doublesecretagency.com/ad-wizard/tracking-views/) via JavaScript. ([#50](https://github.com/doublesecretagency/craft-adwizard/pull/50), thanks @cballenar) +### Fixed +- Fixed bug encountered when saving an Ad Group without a field layout. ([#51](https://github.com/doublesecretagency/craft-adwizard/issues/51)) + ## 4.0.0 - 2024-02-22 ### Changed diff --git a/src/controllers/AdGroupsController.php b/src/controllers/AdGroupsController.php index 02023e3..77c15f9 100644 --- a/src/controllers/AdGroupsController.php +++ b/src/controllers/AdGroupsController.php @@ -139,7 +139,7 @@ public function actionSaveGroup(): ?Response // Get POST values $group->id = $request->getBodyParam('groupId'); - $group->fieldLayoutId = $request->getBodyParam('fieldLayoutId'); + $group->fieldLayoutId = $request->getBodyParam('fieldLayoutId') ?: null; $group->name = $request->getBodyParam('name'); $group->handle = $request->getBodyParam('handle');