You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a confirmation modal to the create action using the requireConfirmation() method, I can set a modalTitle as expected, however setting modalDescription does not overwrite the description.
Looking at the code, I think the issue is in:
/filament/actions/src/Concerns/CanRequireConfirmation.php
If I overwrite the $this->modalDescription line to be: $this->modalDescription ??= fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.confirmation') : null;
it works for my use case. However I have no clue if this breaks other things.
Expected behavior
I expect the description of the confirmation modal to be overwritten from the default "Are you sure you would like to do this?" to the value I provided,
Steps to reproduce
On the Create page for any resource (e.g. CreateSheet), add the following code into the class to turn on the confirmation modal, the title will be correctly set to 'TEST', but the description won't get set to 'TEST2'
To replicate on the reproduction repository, create a user (in the db) and then try and create a sheet record, when you click 'create' and see the modal you won't get TEST2 as the modal description.
Package
filament/forms
Package Version
v3.2.72
Laravel Version
v11.5.0
Livewire Version
v3.4.11
PHP Version
v8.3.6
Problem description
When adding a confirmation modal to the create action using the requireConfirmation() method, I can set a modalTitle as expected, however setting modalDescription does not overwrite the description.
Looking at the code, I think the issue is in:
/filament/actions/src/Concerns/CanRequireConfirmation.php
If I overwrite the $this->modalDescription line to be:
$this->modalDescription ??= fn (MountableAction $action): ?string => $action->evaluate($condition) ? __('filament-actions::modal.confirmation') : null;
it works for my use case. However I have no clue if this breaks other things.
Expected behavior
I expect the description of the confirmation modal to be overwritten from the default "Are you sure you would like to do this?" to the value I provided,
Steps to reproduce
On the Create page for any resource (e.g. CreateSheet), add the following code into the class to turn on the confirmation modal, the title will be correctly set to 'TEST', but the description won't get set to 'TEST2'
To replicate on the reproduction repository, create a user (in the db) and then try and create a sheet record, when you click 'create' and see the modal you won't get TEST2 as the modal description.
Reproduction repository
https://github.com/MikeCodesSomething/filament-create-modal-description-replication/
Relevant log output
No response
The text was updated successfully, but these errors were encountered: