Problem/Motivation

After install taxonomy_unique, we can not change the name/title of terms with the same name field because the constraint from taxonomy_unique checks if the name already exists before auto_entitylabel updates this value.

Any constraint validation will be against the old name value.

The auto_entitylabel seems that update the label on the hook insert/presave so seems to me that any validation on the name field will be ignored.

Proposed resolution

Maybe it should done in the form submit/validation instead on the hook presave/insert.
A good solution could be using entity builders, which is a function called before validation https://git.drupalcode.org/project/drupal/-/blob/2e7b6ca227f23820be4638d...

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

eduardo morales alberti’s picture

Issue summary: View changes

eduardo morales alberti’s picture

Status: Active » Needs review

I forgot to add the !$decorated_entity->isTitlePreserved(), lets see if the tests now passed

giuseppe87’s picture

If the node has a media field, opening it causes the following error:

InvalidArgumentException: Field {$field_name} node is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 587 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Most probably it would be have the same problem with other ajax field.

giuseppe87’s picture

Status: Needs review » Needs work
eduardo morales alberti’s picture

Status: Needs work » Needs review
benstallings’s picture

Status: Needs review » Needs work

Needs to be rebased on the current 8.x-3.x branch -- pretty complex, more than I can handle!