Skip to content

Commit c877403

Browse files
committed
Fix Fluid field when field setting is empty string
1 parent 892a263 commit c877403

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- Handle a scenario where Fluid fields save an empty string in their list of associated fields
8+
59
## [1.1.0] - 2023-06-14
610

711
### Added

src/Fieldtypes/Presenters/FluidFieldPresenter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ 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)->reduce(function ($carry, $group) {
23+
$fields = collect($groupIds)->filter()->reduce(function ($carry, $group) {
2424
return $carry->merge(app(FieldtypeManager::class)->fieldsForFieldGroup($group));
25-
}, new Collection)->merge(collect($fieldIds)->reduce(function ($carry, $field) {
25+
}, new Collection)->merge(collect($fieldIds)->filter()->reduce(function ($carry, $field) {
2626
return $carry->push(app(FieldtypeManager::class)->getField($field));
2727
}, new Collection));
2828

@@ -76,7 +76,7 @@ public function present(FieldContent $content, $arguments)
7676
->orderBy('order')
7777
->get();
7878
}
79-
79+
// dd($usingGroups, $data);
8080
$data = $data->map(function ($row) use ($content) {
8181
return new FieldContent(
8282
array_merge($content->getAttributes(), [

0 commit comments

Comments
 (0)