Skip to content

Commit

Permalink
Set field handle overrides on CustomFieldBehavior on layout save
Browse files Browse the repository at this point in the history
Fixes #14166
Fixes #14221
Resolves #14233
  • Loading branch information
brandonkelly committed Jan 29, 2024
1 parent 8e907d4 commit e6d5133
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- Fixed a bug where all checkboxes would appear checked within selected Matrix blocks.
- Fixed a bug where Recent Entries widgets were getting mangled when new entries were created via Quick Post widgets.
- Fixed a bug where linked chip labels weren’t getting focus rings.
- Fixed an error that could occur when field handles were overridden. ([#14166](https://github.com/craftcms/cms/issues/14166), [#14221](https://github.com/craftcms/cms/issues/14221))

## 5.0.0-alpha.8 - 2024-01-23

Expand Down
7 changes: 7 additions & 0 deletions src/services/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,13 @@ public function saveLayout(FieldLayout $layout, bool $runValidation = true): boo
// Refresh CustomFieldBehavior in case any custom field handles were just added/removed
$this->updateFieldVersion();

// Tell the current CustomFieldBehavior class about the fields, since they might have custom handles
foreach ($layout->getCustomFieldElements() as $layoutElement) {
if (isset($layoutElement->handle)) {
CustomFieldBehavior::$fieldHandles[$layoutElement->handle] = true;
}
}

return true;
}

Expand Down

0 comments on commit e6d5133

Please sign in to comment.