Imported vocab not assigned to node types
freshaspect - April 2, 2009 - 00:15
| Project: | Taxonomy import/export via XML |
| Version: | 6.x-1.3 |
| Component: | Drupal XML format |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
When I import an XML vocabulary containing the tag (as per the sample.xml file) the resulting vocabulary is not actually associated with these node types. All imported taxonomies don't actually seem to be assigned to their node types.
Back in the old version this bit of code:
// The node type array for a vocab has the type name as the key and the value set to 1
// so we have to slightly modify the array
$node_types = explode(',', $_tx_vocabulary['nodes']);
$_tx_vocabulary['nodes'] = array();
foreach ($node_types as $type) {
$_tx_vocabulary['nodes'][$type] = 1;
}
taxonomy_save_vocabulary($_tx_vocabulary);Seemed to do the job of associating the node types with the vocabulary but I can't find any equivalent code in the new version. Any ideas?
Thanks,
Paul

#1
Hm. :(
Yeah, all the work in the D6 version has been towards using interchangable formats from existing specs.
The node-type association is a Drupal-ism I didn't find a place for. Actually there's not a lot of space for metadata *about* the vocab in syntaxes I've been using, but I think it should exist.
Clearly in the old format it has a place, and could be imported, but you're rigth the current harness doesn't expect it or look for it.
Looks like it could be put back in, as per the above code.
Not sure exactly where in the process this should happen. I'll mark this as a nice-to-have fix-up. sometime.
#2
Ok thanks :(
I will roll back to the old version as this is essential functionality for me. I am importing taxonomies as part of an install profile and these need to be associated with the relevant node types without manual intervention.
Paul
#3
A Roll-back from Drupal 6 to Drupal 5 on this basis seems pretty drastic! I'm sure it can and should be worked in. It's just that the legacy drupal-xml format didn't get a lot of testing when I was adding the new features that supported 60,000 -term scientific vocabularies in actual formalized syntaxes.
Please try pasting the code you've identified as missing back in (somewhere) and see what else needs to be done.
#4
I didn't mean a Drupal version rollback :) I meant a taxonomy xml module rollback (to the version that does support node type associations).
I did try adding the old node type code into the new version but there seems to be an upstream problem with how the XML is being parsed as $_tx_vocabulary['nodes'] is always populated with an empty array.
If you can get the parser to populate $_tx_vocabulary['nodes'] correctly I can do the rest.
Thanks,
Paul
#5
Oh.
I couldn't recall anything in recent tweaks that would have deliberately removed that function, I thought it must have gone missing in the version upgrade and refactoring.
Then again, maybe I did. The whole 'defining an actual vocab properties is wnated, but hadn't been solved on the grand scale, maybe that vestigal snippet was snipped.
#6
I too would like my taxonomy XML files on import (as well as installation profile via taxonomy_xml_invoke_import) to retain the node types, required, multiple, etc. settings.
#7
I fixed up the code so that on XML import all XML fields are now being respected. Also works with taxonomy_xml_invoke_import.
#8
Thanks for the contrib. I had a look at it and tried to see if it would fit, but I had some doubts about the structure. That presetting of the array of values didn't really belong in _taxonomy_xml_get_vocabulary_placeholder($name) so I shifted it to where the taxonomy data was actually being read. But in testing I found some underlying issues with the UI and rules around the whole 'determined by source file' idea. Current database access does not allow me nominate the vid I get when creating a new vocab, so things needed to be rewriten to accommodate that.
In short, I ended up spending half a day rewriting and testing that hunk of code! I should have been working towards the taxonomy_server thing instead...
All in CVS DRUPAL-6--2 now. I'll call it 'fixed' although the fix is only in -dev right now. Not sure when the next milestone for a number release will be.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.