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.

CommentFileSizeAuthor
#3 3346434-enabled_validation.patch1.46 KBfran seva
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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alina Basarabeanu created an issue. See original summary.

fran seva’s picture

Status: Active » Needs review
FileSize
1.46 KB

I 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.

i-trokhanenko’s picture

Status: Needs review » Reviewed & tested by the community

MR#3 works well for me. Thanks.

Alina Basarabeanu’s picture

Works as expected on Drupal Version 9.5.10 with unique_entity_title 1.3.0

i-trokhanenko’s picture

Version: 8.x-1.2 » 8.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

i-trokhanenko’s picture

Status: Patch (to be ported) » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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