Seems to work okay. Re: my thoughts at #644444: Generic callback functions, the getter/setter callbacks work with arrays of term ids, import/export functions try to be a bit cleverer.

The export callback returns an array of term objects. I think still to do is to add to those objects a full vocabulary object (output of taxonomy_vocabulary_load()) in place of the vocabulary id. That way people exporting to non-Drupal systems can better piece together the relationships between terms with just the exported nodes to work with. An alternative/complementary approach would be to make vocabularies exportable entities.

The import callback will try to work with pretty much anything: a single integer/string, an array of integer/strings, and array of arrays, an array of objects. When given a numeric value it will try to find a term with that id in the vocabularies that apply to the current content type. When given a non-numeric string or array thereof, it will try to find the corresponding term by first trying taxonomy_get_term_by_name(), then taxonomy_get_synonym_root() if nothing's found, again limiting to appropriate vocabularies for that node type.

Comments

Matthew Davidson’s picture

Assigned: Unassigned » Matthew Davidson
Status: Needs review » Needs work

Each vocabulary should be able to be treated as a separate field, as per the node edit form.

Matthew Davidson’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev
Status: Needs work » Fixed
StatusFileSize
new2.3 KB

We can now access terms from particular vocabularies using field names of the form taxonomy_[vid]. You'll also find these are children of the 'taxonomy' field when you call fieldtool_tree(). A novelty here is that passing FALSE as the value with fieldtool_set() or fieldtool_import() wipes the slate clean, deleting either all terms, or all terms in a particular vocabulary, depending on which field name you use. I'm wondering whether this should be a general rule for all fields; FALSE deletes all values, plus (generally) a way for targeting particular values in multi-value fields. In this case passing array($tid => 0) to fieldtool_set() will only remove the term associated with $tid.

jpetso’s picture

Well I *am* reading this. However, I agree with you that issues don't need the highest level of detail unless user demand is there :)

Matthew Davidson’s picture

Actually, most of the detail is for my benefit. We old guys usually can't remember what we did or why we did it the next day. ☺

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.