Closed (won't fix)
Project:
Drupal core
Version:
7.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Aug 2008 at 16:56 UTC
Updated:
24 Jul 2013 at 08:42 UTC
Jump to comment: Most recent file
Comments
Comment #1
oadaeh commentedI'd really like to help out here, but I'm afraid I'm a little dense. (Well, maybe more than a little.)
If what you're saying is that the taxonomy_form() widget should be combining all vocabularies and autocompleting from the combined total of term lists, then you are correct in that it doesn't work that way. However, looking at the code for taxonomy_form() would lead me to believe it wasn't designed to work that way, so I'm guessing that isn't it.
If what you're saying is that all vocabularies that are presented on a node add/edit form should be autocompleting from their term list but are not, then that part looks like it's working correctly. Or maybe it works in node add/edit, but not elsewhere. I don't know why that would happen, but I guess I'll have to experiment more and see.
If what you're saying is that it should work with vocabularies as well as terms, then, based on the code and the comments, I don't think it was ever designed to work that way.
If you are saying something else, then I'm not understanding (refer to my first and second sentences) and maybe a little more explanation is in order or maybe someone else should be looking at this.
Comment #2
webchickHa, sorry. :) That was vague, indeed.
What I meant was, say I'm building a form, and I want to pull in the widget for selecting taxonomy vocabulary "Category" or something. If "Category" is NOT a free-tagging vocabulary, I simply add:
$form['category'] = taxonomy_form(3);
However, if it IS a free-tagging vocabulary, suddenly I need to copy/paste this big glop of crap out of taxonomy_form_alter() and make my own function and call it instead.
So what I'd like to see is taxonomy_form() consistently return the form widget representation of a vocabulary, regardless of what that widget happens to be.
Does that help?
Comment #3
damien tournoud commentedI'll take this a step forward: taxonomy selectors and free-tagging auto-complete should both be a fapi widgets.
Taxonomy was never really converted to FAPI:
- taxonomy_form_alter should simply be:
(where taxonomy_filter_by_vocabulary() is a small but handy helper function to create using pieces from the current taxonomy_form_alter())
- parts of taxonomy_form should become an "#process" FAPI handler (
expand_taxonomy()), which should manage both select-type widgets and autocomplete freetagging widgets- most of the current
taxonomy_node_save()logic should become a "value" FAPI handler (form_type_taxonomy_value())-
taxonomy_node_save()should become:(Or, more interestingly, it should only save the terms that changed for the vocabularies available in $terms.)
Comment #4
damien tournoud commentedHere is a very starter patch (non functional and partial).
After a discussion with Kaaskop on the IRC, we conclude that it makes sense to split the logic into two different fapi elements: a single/multiple select one and a freetagging one.
Comment #5
xanoHey, Kaaskop here! I need some advice on how to tackle this. I want to provide site admins with the option to prevent nodes from being posted to terms that have child terms. For this I need to change taxonomy_form_alter() and the autocomplete callback. If I want to add these widgets I will also have to change taxonomy_form_alter(). Would it be wise to do all this stuff in a single patch, since they conflict?
//Edit: Problem solved!
Comment #6
xanoAssigning it to myself.
Comment #7
xanoHere's a prelimininary Patch. Select elements don't throw an error if they're required and no terms have been selected. The problem is that Drupal processes the old values instead of the new (empty) one.
Comment #8
xanoI can't get the elements to save their values properly. Here's the latest patch. I'd appreciate it if somebody else could take a look at how those values are saved.
Comment #10
xanoStill haven't solved that problem, but I did clean up some other stuff.
Comment #11
xanoWill continue work on this tomorrow.
Comment #12
xanoFollow-up patch. Note that the term edit pages are not yet converted to use the new widgets, so they don't work. #251595: Add taxonomy_term_load_descendents() would be realy helpful to get this working.
The differences between this patch and the current behaviour in HEAD is that term selectors aren't shown if there are no terms available, due to an empty vocabulary or insufficient permission to access the terms, for instance. Also, the selectors have been moved to the vertical tabs.
Comment #14
dwwNote: this patch probably shouldn't be re-rolled until #462428: Vocabulary help needs filter_xss lands. Reviews (and an RTBC) over there would be appreciated.
Comment #15
xanoThis patch already uses filter_xss_admin(), so there are no security problems.
Comment #16
catchBump.
Xano - this has a lot less to do now that tagging is a Field API widget - we just need to kill _taxonomy_term_select() - think you can re-roll?
Comment #17
xano#603702: Die, _taxonomy_term_select(), die!.
Comment #18
xano