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
Comment | File | Size | Author |
---|---|---|---|
#10 | article_with_unique_title.png | 25.69 KB | akshay_d |
#9 | title-validation-with-base-field-overrides-3050258-9.patch | 911 bytes | harika gujjula |
#3 | unique-entity-title.png | 33.91 KB | harika gujjula |
Comments
Comment #2
Andy-vv CreditAttribution: Andy-vv commentedAh 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
Comment #3
harika gujjula CreditAttribution: harika gujjula at Specbee commentedHey @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?
Comment #4
Andy-vv CreditAttribution: Andy-vv commentedHello 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
Comment #5
j0e CreditAttribution: j0e commentedHi 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.
Comment #6
brooke_heaton CreditAttribution: brooke_heaton commentedYes, 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.
Comment #7
brooke_heaton CreditAttribution: brooke_heaton commentedI 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.
Comment #8
matt_paz CreditAttribution: matt_paz commentedComment #9
harika gujjula CreditAttribution: harika gujjula at Specbee commentedAdding a patch to support Validations even for Title label overrides of an entity type.
Comment #10
akshay_dTest 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
Comment #11
imalabyaComment #13
imalabyaThank you all for your contribution. 🙏🏻
Comment #15
raveena CreditAttribution: raveena commentedHi, 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)