Hello everyone,

I am a bit of a newbie to Drupal 8 so this is probably a simple mistake by me.
I have installed and activated Unique Entity Title on my Drupal 8 site.
I have set the "unique entity requirement" on a content type called "Streets" (see attached screenshot)
I have cleared the caches.
I have created two "street" entities with the same name "Woodville Road"

Drupal saves both of these quite happily and lists them in my Content (see screenshot).

This seems to me that the control of unique Entity Names is not working?

Can anyone shed some light on this for me? I need to be able to stop the creation of duplicate "Streets" (and many other content types).

Regards,

Andy

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Andy-vv created an issue. See original summary.

Andy-vv’s picture

Ah ha, I think I found the issue. The module does not work retroactively on existing content types that I made BEFORE installing Unique Entity Title Module.

If I delete my "Streets" content type and re-create it then the Module Works perfectly and blocks identical names.

Is this how you expected the module to work? Or should it work on existing content types?

Regards,
Andy

harika gujjula’s picture

FileSize
33.91 KB

Hey @Andy, Thanks for your time. Strange! I tried testing with multiple scenarios, but i don't see it fails. I even tried with unpublish state after seeing your screenshot provided. It still worked for me. Can you help me providing more details in your case.
Can you try for Article/basic page content type - Which is also Existing content type.
Are there any other Third party settings provided by other modules?
What is the Drupal core version?

Andy-vv’s picture

Hello Harika! Many thanks for the help, it is much appreciated.
I tried the retroactive setting for the content type "Article" , and it worked exactly as you suggested.
I then tried it for some of the content types I created and it did not.
The only difference I can see is that for these other types, I changed the "Title" label field when I was creating the content type.
I then tried creating an entirely new content type. If I leave the Title field label as "Title" it works fine. If I set the content type up and change the title filed label to "Run ID" (for example), then duplicates are possible. Very odd.
If I reset the title field label back to "Title", then it still accepts duplicates. To get it to work I need to start creating the content type form the beginning again.

My workaround for the moment is never to change the "Title" label!!

My Drupal core is 8.6.15

j0e’s picture

Hi Andy, I can confirm I experienced the same issue. Once I changed the name of the title field for a content type, the module no longer blocked identical titles. And even if I changed the title field's name back to Title, it still didn't work any longer.

brooke_heaton’s picture

Yes, this same logic exists on node_title_validation and it's a fatal flaw. The module should be refactored to account for a change in the label of the title.

brooke_heaton’s picture

I can confirm the exact behavior from #5. I tried this on a content type for which the title label was never changed and it successfully validated.

matt_paz’s picture

harika gujjula’s picture

Status: Active » Needs review
FileSize
911 bytes

Adding a patch to support Validations even for Title label overrides of an entity type.

akshay_d’s picture

Test cases:
Case 1:
1. Create a new content type “Article”.
2. Change the Title label To Article Title.
3. Enable “Unique entity title” setting.
4. Try to create 2 contents of type “Article” with the same name.
It does not allow me to create the contents.

Case 2:
1. Remove the label. Make it to default as “Title”.
2. Enable Unique entity title.
3. Try to create an Article content with the same name.

It shows an error.

Added screenshot

imalabya’s picture

Status: Needs review » Reviewed & tested by the community

imalabya’s picture

Status: Reviewed & tested by the community » Fixed

Thank you all for your contribution. 🙏🏻

Status: Fixed » Closed (fixed)

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

raveena’s picture

Hi, i have drupal 7 setup and unique enitity module is not not available in drupal 7 is there any alternate for this type validation.
(Content title name should not duplicate)