Modify the error message about the maximum upload file size
-
18-02-2021 - |
Вопрос
I would like to modify the default error message for the maximum upload file size, but I can't find the configuration.
I looked at webform general settings, individual settings, and media file settings, but I found nothing about it. Forum issues only talk about configuration of the maximum file size, not about customization of the error message.
Can anyone help me?
Решение
As far as I know, there is not a way to add a validation handler for the file field type in general. You'll need to set a hook form alter and add a custom form validate handler for the edit forms, webforms, etc that you want to override.
Refer to: How do I add a custom validation handler to an existing form/field?
Alternatively, if your site is a multilingual site configured for internationalization, you can probably override the english version of the message in the. po file. I would advise against installing and enabling internationalization just for this use case, as it adds several pieces of functionality to the site and can bloat your database.