Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Content type with Unique Entity Title off can't be saved because the constraint validation on the field is always failing with the following error:
Warning: Undefined array key 0 in unique_entity_title/src/Plugin/Validation/Constraint/UniqueEntityTitleValidator.php on line 17
Proposed resolution
Check if the entity has the unique entity title enabled before adding the violation.
Comment | File | Size | Author |
---|---|---|---|
#3 | 3346434-enabled_validation.patch | 1.46 KB | fran seva |
Issue fork unique_entity_title-3346434
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
Comment #3
fran seva CreditAttribution: fran seva at 1xINTERNET commentedI found this patch is causing errors when try to access to get the value when we create a new content. Before we access to [0] it is needed to check item has a value. As part of it I have also ensure we never pass a null value to isNotUnique due to that's causing more issues with php8.1.
Comment #4
i-trokhanenkoMR#3 works well for me. Thanks.
Comment #5
Alina Basarabeanu CreditAttribution: Alina Basarabeanu at Cyber-Duck commentedWorks as expected on Drupal Version 9.5.10 with unique_entity_title 1.3.0
Comment #6
i-trokhanenkoComment #8
i-trokhanenkoThanks!