Skip to content

Filament\Forms\Component\Builder::blockPickerColumns() method doesn't accept Closure #19879

Description

@CarlEdmondson

Package

filament/forms

Package Version

v5.6.3

Laravel Version

v13.9.0

Livewire Version

v4.3.0

PHP Version

PHP 8.4.13

Problem description

The documentation indicates that the Filament\Forms\Component\Builder::blockPickerColumns() method should be able to accept a function to dynamically calculate the number of columns. However the method only accepts array, int, or null types as its argument.

If you pass in a Closure as the argument then this results in a TypeError being thrown.

Expected behavior

According to the documentation, the method should accept a Closure that can be used to determine the number of columns.

Steps to reproduce

Create a builder and pass in a Closure as the argument for the blockPickerColumns() method.

Builder::make('test')
    ->blocks([
        Builder\Block::make('text')
            ->schema([
                TextInput::make('test_input')
                    ->label('Text Input'),
            ])
    ])
    ->blockPickerColumns(function() {
        return 2;
    });

Reproduction repository (issue will be closed if this is not valid)

https://github.com/CarlEdmondson/filament-blockPickerColumns-bug

Relevant log output

TypeError
vendor/filament/forms/src/Components/Builder.php:1067
Filament\Forms\Components\Builder::blockPickerColumns(): Argument #1 ($columns) must be of type array|int|null, Closure given, called in /var/www/html/app/Filament/Resources/Pages/Schemas/Components/PageBuilder.php on line 91

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions