Posted by Amitaibu on February 19, 2008 at 1:38pm
Jump to:
| Project: | Unique field |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Thanks for the awesome module. Would be nice if in the scope of unique values admin will be able to filter the results according to a views - like in the CCK nodereference
Comments
#1
For that matter, I think Views should be used to determine uniqueness. The majority of this module is query-building code. Drupal already has a query builder: Views. This would not only remove the current limitation to CCK fields and mean you automatically support any fields that have Views integration, but would also open the module up to imposing uniqueness constraints on things other than nodes.
The way I think it might work would be to define a new Views display type ("Uniqueness", or something). When a node (or user, or taxonomy term...) form submission is being validated, any relevant "Uniqueness" views are executed, using values from the form submission in the view arguments. If any results are returned, the form doesn't validate.
I haven't worked much with the Views 2 API (don't think it's worth backporting to Views 1), but I think this approach is feasible, and would clean up most of the issues currently in the queue. Would also clean up your UI code, as you'd be mostly using the Views UI.
Would like to work on this myself, but won't have time for quite a while. :(
#2
I am pretty much the same opinion. Although it IS a great module and it does its job most of the times, it's kinda messy inside. I just reviewed the code in order to make ajax-checks working, but I feel a bit lost in this huge hook_nodeapi definition. I mean, taxonomy and CKK are quite different things in terms of architecture and this should actually be reflected in the module's code, I suppose.
So if we want to get anything near Views, the architecture has to be rewritten completely with more focus on encapsulation. And this is not gonna happen, I believe ;)
#3
+1