Custom ->requiresConfirmation message?

Is it possible to override or provide a custom confirmation message for the filament DeleteAction?
1 Reply
ConnorHowell
ConnorHowell13mo ago
Yes just set your own ->modalDescription on the action Here's the source on requiresConfirmation which should give you an idea of how it's working behind the scenes and therefore how you're able to override it:
public function requiresConfirmation(bool | Closure $condition = true): static
{
$this->modalAlignment(fn (MountableAction $action): ?Alignment => $action->evaluate($condition) ? Alignment::Center : null);
$this->modalFooterActionsAlignment(fn (MountableAction $action): ?Alignment => $action->evaluate($condition) ? Alignment::Center : null);
$this->modalIcon(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'heroicon-o-exclamation-triangle' : null);
$this->modalDescription(fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.confirmation') : null);
$this->modalSubmitActionLabel(fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.actions.confirm.label') : null);
$this->modalWidth(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'md' : null);

return $this;
}
public function requiresConfirmation(bool | Closure $condition = true): static
{
$this->modalAlignment(fn (MountableAction $action): ?Alignment => $action->evaluate($condition) ? Alignment::Center : null);
$this->modalFooterActionsAlignment(fn (MountableAction $action): ?Alignment => $action->evaluate($condition) ? Alignment::Center : null);
$this->modalIcon(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'heroicon-o-exclamation-triangle' : null);
$this->modalDescription(fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.confirmation') : null);
$this->modalSubmitActionLabel(fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.actions.confirm.label') : null);
$this->modalWidth(fn (MountableAction $action): ?string => $action->evaluate($condition) ? 'md' : null);

return $this;
}
Want results from more Discord servers?
Add your server