Skip to content

Commit 3cf2cb4

Browse files
[5.x] Fix existing field validation with prefixed fieldset imports (#13551)
1 parent f180fc3 commit 3cf2cb4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Http/Controllers/CP/Fields/FieldsController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ function ($attribute, $value, $fail) use ($request) {
7474
->when($request->has('id'), fn ($collection) => $collection->reject(fn ($field) => $field['_id'] === $request->id))
7575
->flatMap(function (array $field) {
7676
if ($field['type'] === 'import') {
77-
return Fieldset::find($field['fieldset'])->fields()->all()->map->handle()->toArray();
77+
return Fieldset::find($field['fieldset'])
78+
->fields()->all()
79+
->map(fn ($importedField) => ($field['prefix'] ?? '').$importedField->handle())
80+
->values()
81+
->toArray();
7882
}
7983

8084
return [$field['handle']];

0 commit comments

Comments
 (0)