Skip to content

Commit 36bacfe

Browse files
committed
Fix return values for fluid fields when there are no children
1 parent 9edec1b commit 36bacfe

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
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+
- Return value for Fluid Field when there are no children
8+
59
## [1.4.1] - 2024-09-23
610

711
### Fixed

src/Fieldtypes/FluidField.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ public function apply(FieldContent $content, array $parameters = [])
3535

3636
public function generateGraphType(ChannelField $field)
3737
{
38-
$groupIds = $field->field_settings['field_channel_field_groups'] ?? [];
39-
$fieldIds = $field->field_settings['field_channel_fields'] ?? [];
38+
$groupIds = array_filter($field->field_settings['field_channel_field_groups'] ?? []);
39+
$fieldIds = array_filter($field->field_settings['field_channel_fields'] ?? []);
4040
$fields = collect($groupIds)->reduce(function ($carry, $group) {
4141
return $carry->merge(app(FieldtypeManager::class)->fieldsForFieldGroup($group));
4242
}, collect())->merge(collect($fieldIds)->reduce(function ($carry, $field) {
4343
return $carry->push(app(FieldtypeManager::class)->getField($field));
4444
}, collect()));
4545

46-
$fields = collect($field->field_settings['field_channel_fields'] ?? [])->map(function ($id) {
46+
$fields = collect($fieldIds)->map(function ($id) {
4747
return app(FieldtypeManager::class)->getField($id);
4848
});
4949

50-
$groups = collect($field->field_settings['field_channel_field_groups'] ?? [])->map(function ($id) {
50+
$groups = collect($groupIds)->map(function ($id) {
5151
$fields = app(FieldtypeManager::class)->fieldsForFieldGroup($id);
5252

5353
if ($fields->isEmpty()) {

0 commit comments

Comments
 (0)