Open mkrecek234 opened 1 year ago
Completely agree, about two years ago it was removed when the actions were migrated to UA and since then I always patched in localy like:
abstract class MyModel extends Model
{
protected function init(): void
{
parent::init();
// ask user for confirmation when delete button is pressed
$this->getUserAction('delete')->confirmation = 'Do you want to delete this record?';
}
}
If we add any text here in atk4/data, how is it supposed to work with translation in the future? We cannot import/support anything about translations in atk4/data.
I would propose to add the possibility in atk4/data to add a (localised) text handling function. If not added, it uses its own hard-wired system texts. If it is defined, you can then set any localistion _t function - as extensively discussed with the community, the texts should have unique identifiers like model.delete.confirmation.
This is a separate topic, and not related to this PR: We have plenty of system texts in atk4/data that cannot be localised. As long as we do not have a localisation interface for atk4/data, we should continue implementing texts in hard-wired English in atk4/data.
Feel free to send a PR for this, I fully agree the confirmation for delete should be in opt-out fashion.
Steps to reproduce:
Expected behaviour: By default, there should be a confirmation required before deletion
So adding
'confirmation' = 'Do you really want to delete this record?'
herehttps://github.com/atk4/data/blob/448e3085699c9a1b2591a777129b4f9bbf317704/src/Model/UserActionsTrait.php#L135