F
Filament2mo ago
Sivan

Builder\Block MaxItems show error

Hi Everyone, I want to limiting the number of times a block but it shows error. I am using the pages. Here is code snippet and error message Builder::make("content[" . $locale . "]") ->label("Content") ->blockPickerColumns(['sm' => 1, 'md' => 2, 'xl' => 2]) ->blockNumbers(false) ->blocks([ Builder\Block::make("location[" . $locale . "]") ->label("Location") ->icon("heroicon-s-map-pin") ->MaxItems(2) ->schema([ ...Location::make($locale), ]) ]), Error array_filter(): Argument #1 ($array) must be of type array, null given How can i Fix this
No description
10 Replies
LeandroFerreira
LeandroFerreira2mo ago
does it work if you remove ->MaxItems(2) ?
Sivan
Sivan2mo ago
yes @Leandro Ferreira
Sivan
Sivan2mo ago
my Builder\Block want to added by only once not unlimited
LeandroFerreira
LeandroFerreira2mo ago
I don't think this is the issue Did you do this?
public function mount(): void
{
$this->form->fill();
}
public function mount(): void
{
$this->form->fill();
}
Sivan
Sivan2mo ago
@Leandro Ferreira I added the above code snippet it working fine. But this code snippet cannot find under form builder? Why?
LeandroFerreira
LeandroFerreira2mo ago
what does it mean?
Sivan
Sivan2mo ago
I cannot find this code snippet under the Form Builder documentation. Why? while adding maxItems
Sivan
Sivan2mo ago
I got it, Thanks @Leandro Ferreira
Want results from more Discord servers?
Add your server