Infolist Action `->createAnother()` doesn't exist

We want to be able to reproduce the ->createAnother() functionality which exists on a Filament\Actions\CreateAction component but Infolists only accept instances of Filament\Infolists\Components\Actions\Action which doesn't have the ->createAnother() option.

I have thought about creating our own Action in our codebase, which extends the CreateAction class (to inherit the ->createAnother() function), but using this in an Infolist instance would also fail to satisfy the requirement for it to be an instance of Filament\Infolists\Components\Actions\Action.

How can we go about doing this? 🤔
Solution
try this

->action(function (array $data, Action $action, array $arguments, Form $form) {

    if ($arguments['another'] ?? false) {

        //do something

        $form->fill();
        $action->halt();

        return;
    }

    //do something
})
->extraModalFooterActions(fn (Action $action) => [
    $action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
])
Was this page helpful?