Closed (fixed)
Project:
Unique entity title
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Sep 2025 at 14:45 UTC
Updated:
11 Mar 2026 at 10:45 UTC
Jump to comment: Most recent
Comments
Comment #3
miroslavstankov commentedI would like to work on this issue
Comment #5
miroslavstankov commentedThis functionality—checking uniqueness only within the same bundle— as I can see is already implemented in the current codebase. I tested it with content types and taxonomy terms as follows:
- Tried adding the same title twice in the Article content type, and it correctly threw an error for duplicate titles.
- Then added the same title in a different content type (Basic page), and it allowed it, since uniqueness is scoped per bundle.
- Performed the same checks for taxonomy terms, with the expected behavior.
Additionally, I added a functional test to cover this scenario for extra assurance.
One more note: I replaced the deprecated @Constraint annotation with the newer PHP attribute syntax for validation constraints:
#[\Drupal\Core\Validation\Attribute\Constraint(
id: 'UniqueEntityTitle',
label: new TranslatableMarkup('Unique Entity Title', [], ['context' => 'Validation']),
type: ['string']
)]
Overall, no code changes are necessary to support the requested feature, as it’s already working as intended. Happy to discuss further if needed!
Comment #6
anybodyNe @miroslavstankov you're right, my bad! Nice new tests, RTBC from my side!
Comment #8
i-trokhanenkoCommitted, thanks!