fix: exception when using hasBlockPreviews in Builder component (#17937)

* fix: `builder` clone default child components only when hasBlockPreviews is enabled

* fix: php stan && code formatting

* refactor: replace collection map with array_map for cloning default child components in builder

* fix: clone block before retrieving default child components in builder modals
This commit is contained in:
WenRenHai
2025-09-25 08:56:11 +01:00
committed by GitHub
parent 0f1deeb253
commit 73fd07ee07
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -191,7 +191,7 @@ class Builder extends Field implements CanConcealComponents, HasExtraItemActions
]))
->modalSubmitActionLabel(__('filament-forms::components.builder.actions.add.modal.actions.add.label'))
->schema(function (array $arguments, Builder $component): array {
return $component->getBlock($arguments['block'])->getDefaultChildComponents();
return $component->getBlock($arguments['block'])->getClone()->getDefaultChildComponents();
});
}
@@ -286,7 +286,7 @@ class Builder extends Field implements CanConcealComponents, HasExtraItemActions
]))
->modalSubmitActionLabel(__('filament-forms::components.builder.actions.add_between.modal.actions.add.label'))
->schema(function (array $arguments, Builder $component): array {
return $component->getBlock($arguments['block'])->getDefaultChildComponents();
return $component->getBlock($arguments['block'])->getClone()->getDefaultChildComponents();
});
}
+1 -1
View File
@@ -372,7 +372,7 @@ class TextColumn extends Column implements HasEmbeddedView
->merge($stateItemAttributes->getAttributes(), escape: false)
->toHtml() ?>>
<?php if ($stateItemContentAttributes) { ?>
<span <?= $stateItemContentAttributes->toHtml() ?>>
<span <?= $stateItemContentAttributes->toHtml() ?>>
<?php } ?>
<?= $stateItemIconBeforeHtml ?>