Currently, all error messages are hardcoded in the module - $form_state->setErrorByName($field_name, t('The field @field_label has to be unique.', ['@field_label' => $field_label]));

It should be possible to customize warnings.

Solution:
1. Create a new permission to access the config page.
2. Create a new /admin/config/content/unique-fields route.
3. Create a form with three text fields (node/term/user) to add warning messages.
all fields should be optional and should provide a description about the @label placeholder.
all field values should be saved to the unique_field.settings config under the warnings key
4. Update validation callbacks to show custom messages.

notes:
- we should show an old message if the config is empty;
- we should support @label placeholder;
- it should be possible to translate warnings

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

astonvictor created an issue. See original summary.

astonvictor’s picture

Issue summary: View changes
astonvictor’s picture

Issue summary: View changes
lysenko’s picture

Assigned: Unassigned » lysenko

astonvictor’s picture

Assigned: lysenko » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.