Skip to content

Commit

Permalink
Fix issue with cloning form fields always cloning the last item rathe…
Browse files Browse the repository at this point in the history
…r than the one that was clicked
  • Loading branch information
holmesadam committed Dec 19, 2024
1 parent 2a4e327 commit 0a955c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Concerns/Schemata.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ public static function getSectionsSchema(): array
->cloneable()
->minItems(1)

->cloneAction(fn (Action $action) => $action->action(function (Component $component) {
->cloneAction(fn(Action $action) => $action->action(function (Component $component, $arguments) {
$items = $component->getState();
$originalItem = end($items);
$originalItem = $items[$arguments['item']];
$clonedItem = array_merge($originalItem, [
'name' => $originalItem['name'] . ' new',
'options' => [
Expand Down

0 comments on commit 0a955c0

Please sign in to comment.