#Modal Action with Wizard, add additional Footer Actions

19 messages · Page 1 of 1 (latest)

sand spruce
#

I am using a the ->steps() method on an Action, to create a Wizard with a modal action:

use Filament\Forms;
use Filament\Tables\Actions\Action;

Action::make('wizard')
    ->steps([
        Forms\Components\Wizard\Step::make('Step 1')
            ->schema([
                Forms\Components\TextInput::make('foo'),
            ]),
        Forms\Components\Wizard\Step::make('Step 2')
            ->schema([
                Forms\Components\TextInput::make('bar'),

            ]),
    ])

I am trying to register an additional footer action to this modal; what I have tried:

Action::make('wizard')
    ->steps([/* ... */])
    ->extraModalFooterActions(fn (Action $action): array => [
        $action->makeModalSubmitAction('Another', arguments: ['foo' => 'bar']),
    ]),
    ->registerModalActions([
        Action::make('Another')
    ]),

Having a dig around, I think I am being "hindered" by the getModalFooterActions() method on the CanOpenModal trait, it appears to ignore the above methods as a result of the modal containing a wizard, so I assume I'm missing a method I should be calling instead?

Any help very much appreciated ❤️

cyan kettleBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

dusty monolith
#

Becuase you are using Steps I suspect the footer actions wont work because a wizard goes forward, backwards and submit. What I suspect you want, is the form method not steps, and then Call the Wizard class in the form, with the steps. Then your modal actions will work.

sand spruce
#

modal-ception 🥲

dusty monolith
#

Exactly 🙂

sand spruce
#

well, that's a shame

#

I'm gonna keep hunting around the api; here's hoping that's not the solution.

dusty monolith
#

What do you want to change about it

sand spruce
#

I would like to add an additonal action

dusty monolith
#

Which you can do now

sand spruce
#

how?

dusty monolith
#

with extraFooterActions

#

->extraModalFooterActions(fn (Action $action): array => [
$action->makeModalSubmitAction('Another', arguments: ['foo' => 'bar']),
]),

sand spruce
#

oh, you mean on here?

dusty monolith
#

exactly, that's where they get added

sand spruce
#

oh, I ain't using a nested Wizard haha, that looks terrible

dusty monolith
#

Then add your own wizard 🙂

sand spruce
#

I'd rather just not use the wizard, or maybe edit the action to fire another confirmation modal with the two options in that

sand spruce
#

I'm just gonna add the "other action" as a toggle on the final page... I think that'll appease our UX peeps