F
Filament4mo ago
blink

Why delete modal has acition label 'confirm' instead of 'delete'?

If it is not overlooked and default, how can I update it globally? I checked language files it suggest label should be 'delete' but i see confirm
Solution:
It doesn’t care what the action is, just that it doesn’t execute the action without confirmation.
Jump to solution
8 Replies
awcodes
awcodes4mo ago
Because it’s a confirmation modal, it can apply to more than just delete.
blink
blinkOP4mo ago
Don't you think it needs an update? I think $this->requiresConfirmation(); should come before setting labels in the delete action. Because in the delete action, labels are set correctly, but $this->RequiresConfirmation() overwrites them? I think it will be good for all actions that requires confirmation by default Aww, you’re a core team member! Would you suggest making a PR? I’d be glad to contribute.
awcodes
awcodes4mo ago
Where are you calling $this->requiresConfirmation() it should read all the labels correctly.
awcodes
awcodes4mo ago
The delete action is manually setting all the labels, so you should be able to do the same. https://github.com/filamentphp/filament/blob/3.x/packages/actions/src/DeleteAction.php
GitHub
filament/packages/actions/src/DeleteAction.php at 3.x · filamentph...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
blink
blinkOP4mo ago
Where are you calling $this->requiresConfirmation() it should read all the labels correctly.
I do not; it is included in the default delete action class. Originally, I wanted to change the label of the delete modal confirm action globally. I checked the language files, but saw 'delete' in the translation, but 'confirm' on the modal. I suspected it was due to the default requiresConfirmation () thing and your answer made all clear.
awcodes
awcodes4mo ago
Yea. The confirmation modal is generic as it should be.
Solution
awcodes
awcodes4mo ago
It doesn’t care what the action is, just that it doesn’t execute the action without confirmation.
blink
blinkOP4mo ago
Sure, thanks 🙏

Did you find this page helpful?