Skip to content

Commit 95c8ea7

Browse files
committed
Fix fluid display when referencing deleted fields
1 parent c877403 commit 95c8ea7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Fixed
66

77
- Handle a scenario where Fluid fields save an empty string in their list of associated fields
8+
- Displaying Fluid field when one of the content fields has been deleted but not unassociated
89

910
## [1.1.0] - 2023-06-14
1011

src/Fieldtypes/Presenters/FluidFieldPresenter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ public function present(FieldContent $content, $arguments)
2020
$groupIds = $content->field->field_settings['field_channel_field_groups'] ?? [];
2121
$fieldIds = $content->field->field_settings['field_channel_fields'] ?? [];
2222

23-
$fields = collect($groupIds)->filter()->reduce(function ($carry, $group) {
24-
return $carry->merge(app(FieldtypeManager::class)->fieldsForFieldGroup($group));
25-
}, new Collection)->merge(collect($fieldIds)->filter()->reduce(function ($carry, $field) {
26-
return $carry->push(app(FieldtypeManager::class)->getField($field));
27-
}, new Collection));
23+
$fields = (new Collection(collect($groupIds)->flatmap(function ($group) {
24+
return app(FieldtypeManager::class)->fieldsForFieldGroup($group);
25+
})->merge(collect($fieldIds)->map(function ($field) {
26+
return app(FieldtypeManager::class)->getField($field);
27+
}))->filter()))->unique();
2828

2929
if ($content->entry->isPreview()) {
3030
$order = 0;

0 commit comments

Comments
 (0)