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.
Since Drupal 7 allows us to define fields not only to nodes, I would like to see this module working on fields in general and not only for nodes (now you need to setup this functionability per node or per node type.
For example: I've got a file with fields and I want to make one of those fields to have unique values.
Comments
Comment #1
lindsayo CreditAttribution: lindsayo commentedI second this request. I need Employee ID on user profiles and need it to be unique. Thanks for your work on this module! I've found it useful on several projects. :)
Comment #2
vito_swat CreditAttribution: vito_swat commented+1. I need unique 'display name' text field for users.
Comment #3
alliax CreditAttribution: alliax commentedSubscribing, I'd need unique adsense id in an adsense revenue sharing site for user profiles, so they can't put in existing adsense id. Thanks if you get around to do it.
Comment #4
Pomliane CreditAttribution: Pomliane commentedIt would be nice to have unique fields in comments too. :)
Comment #5
univate CreditAttribution: univate commentedI agree, this seems like the logical progression for this module.
Comment #6
arithmetric CreditAttribution: arithmetric commentedI like this idea, and will be looking into it as time permits. I'd welcome patches from others as well. I think this may be related: #1185904: Evaluate using EntityFieldQuery for content queries
Comment #7
derhasi CreditAttribution: derhasi commentedThat's a great idea ;)
I guess to implement this, hook_field_attach_validate() is the only way, instead of using hook_node_validate().
@see http://api.drupal.org/api/drupal/includes--common.inc/function/entity_fo...
Using field API functions should ease lot here, @see #1163924: Error with Node Reference Module.
edit: I hope to solve a similar issue (#1212766: promote taxonomy_path/entity_path to full module) soon. There we almost figured out, how to place the configuration form, for the entity bundles...
Comment #8
pcambrasuscribe, I'd say one of the biggest issues here is how to place the settings form per bundle, as some bundles don't have edit form themselves and afaik there's no straight way to get the admin url for those that have.
Comment #9
TommyChrissub
Comment #10
johnvsubscribe.
Other (duplicate?) requests are:
#1362444: Field collection support
#1416044: in profile field
#1365890: Allow setting unique constraint to fields in relation.
If this feature requires substantial re-writing, shouldn't we #1319396: Join forces with Field Validation ?
Comment #11
hass CreditAttribution: hass commentedI need this for validation of a user textfield that is used for a membership-id and that must be unique... :-) Any timeplans for this case resolution?
Comment #12
HLopes CreditAttribution: HLopes commentedMy guess is not so soon, as the module as-is relies on hook_node_validate, and there is no such thing as hook_entity_validate.
Maybe it should go down onto the field validation, instead of up to entity validation?
Anyway, +1 for this feature.
Comment #13
hass CreditAttribution: hass commentedI just tested field_validation module today and it works great. If I were you, I would stop re-inventing the wheel... just write a migration module for D6 users to field_validation and discontinue this module here to join forces over there... With this in mind I would be happy to be able to unsubscribe from this case or if we close it and point all users to field_validation... aka WONT FIX
Comment #14
adammaloneI would be interested in writing a unique_entity module. At present I have a unique comments module - http://drupal.org/project/unique_comments that I've written to address some desire in the community to have unique comments. If people think a unique_entity module would be useful I'd be attentive to discussion about it.
Comment #15
prezaeis CreditAttribution: prezaeis commentedany updates on this? im trying to get profile2 fields validated and nothing seems to work :(
Comment #16
josebc CreditAttribution: josebc commented+1
Comment #17
nimek CreditAttribution: nimek commented+1
Comment #18
Yuri CreditAttribution: Yuri commentedAny progress on unique fields for custom entities, i.e. ECK entities?
Comment #19
nimek CreditAttribution: nimek as a volunteer commentedIf you look for more generic solution please look on my project entity unique https://www.drupal.org/sandbox/nimek/2704251
Comment #20
AstonVictor CreditAttribution: AstonVictor as a volunteer and at DevBranch commentedI'm closing it because the issue was created a long time ago without any further steps.
if you still need it then raise a new one.
thanks