Skip to content

Commit

Permalink
Fixed #14838
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed May 22, 2024
1 parent 8a4f657 commit 866a367
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Fixed a bug where entry GraphQL queries weren’t available if only nested entry field queries were selected in the schema.
- Fixed a bug where chip labels could wrap unnecessarily. ([#15000](https://github.com/craftcms/cms/issues/15000), [#15017](https://github.com/craftcms/cms/pull/15017))
- Fixed a bug where date/time clear buttons could bleed out of their container. ([#15017](https://github.com/craftcms/cms/pull/15017))
- Fixed an error that occurred when editing an element, if any field layout conditions referenced a custom field that was no longer included in the layout. ([#14838](https://github.com/craftcms/cms/issues/14838))

## 5.1.4 - 2024-05-17

Expand Down
9 changes: 8 additions & 1 deletion src/fields/conditions/FieldConditionRuleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,16 @@ public function modifyQuery(QueryInterface $query): void
*/
public function matchElement(ElementInterface $element): bool
{
try {
$fieldInstances = $this->fieldInstances();
} catch (InvalidConfigException) {
// The field doesn't exist
return true;
}

// index the field instance UUIDs
$instanceUids = array_flip(
array_map(fn(FieldInterface $field) => $field->layoutElement->uid, $this->fieldInstances()),
array_map(fn(FieldInterface $field) => $field->layoutElement->uid, $fieldInstances),
);

foreach ($element->getFieldLayout()->getCustomFields() as $field) {
Expand Down

0 comments on commit 866a367

Please sign in to comment.