Disabling ->createOptionForm

Looks like Filament is interpreting a returning null the same as an empty array.

I have a repeater in a form that allows on-the-fly creation with ->createOptionForm
I would like to disable the Modal Form for existing repeater rows.
        ->createOptionForm(function($state){
            if($state) {
                return null;
            }else {
                return [
                    Group::make([
                        TextInput::make('name.prefix')->columnSpan(2),
                        TextInput::make('name.first_name')->columnSpan(4)->required(),
                        TextInput::make('name.middle_name')->columnSpan(1)->label('Middle'),
                        TextInput::make('name.last_name')->columnSpan(4)->required(),
                        TextInput::make('name.suffix')->columnSpan(1),
                   ])->columns(12),
                ];
            }
        }),


In short:
->createOptionForm(null); //hides create form
->createOptionForm( fn($state) => null);// Shows empty form

Not sure if this is a bug in Filament but it prevents any possibility of hiding/disabling the create form.
Was this page helpful?