Skip to content

Migrate getFormActions from v2 to v3 #12675

Answered by leandrocfe
Roboroads asked this question in Help
Discussion options

You must be logged in to vote
private $prepared = false;

protected function getFormActions(): array
{
    return [
        ...parent::getFormActions(),
        Actions\Action::make('prepare')
            ->action(function () {
                $this->prepared = true;
            })
            ->hidden(fn () => $this->prepared),
    ];
}

protected function getSaveFormAction(): Action
{
    return parent::getSaveFormAction()
        ->visible(fn () => $this->prepared);
}

protected function getCancelFormAction(): Action
{
    return parent::getCancelFormAction()
        ->visible(fn () => $this->prepared);
}

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Roboroads
Comment options

@leandrocfe
Comment options

Answer selected by Roboroads
@Roboroads
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants