It looks like og_vocab only needs to own its vocabularies in order to remove other groups' vocabularies from node forms. Looking at the Organic Groups code, the only thing that requires another module to own their vocabularies is when they want to implement hook_term_path, which og_vocab doesn't do.
Reason I ask is that I'd like to use og_vocab along with nodeorder, which implements hook_term_path.
Is there a way around this, or another reason why og_vocab sets the 'module' field in the vocabulary table?
Thanks,
Marc
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | og_vocab-2_0.diff | 964 bytes | dmhouse |
| #1 | og_vocab_vocabulary_patch.patch | 1.49 KB | marcp |
Comments
Comment #1
marcp commentedAttached is a patch that keeps og_vocab from taking ownership of the vocabularies. There should be entries in the og_vocab table that make it unnecessary to set the vocabulary's module name.
Seems like I must be missing something?
Comment #2
marcp commentedset to "code needs review"
Comment #3
moshe weitzman@drupal.org commentedthese are group specific vocabs and og_vocab module rightfully marks them as such. it sounds like hook_term_path() cares about all system controlled vocabs which sounds pretty dumb at first blush. could you elaborate where the conflict is exactly? i would rather not relinquish ownership of these vocabs. i have no specific reason for that - just principle.
Comment #4
marcp commentedYes, I agree that since these are group-specific vocabs, it makes sense for og_vocab to mark them as such.
hook_term_path() is the only hook called by taxonomy that targets a specific module, as opposed to allowing all modules to return something. taxonomy_term_path() is the only function that calls module_invoke:
...and it's the only place where the 'module' field in the vocabulary table is used (by taxonomy.module).
Nodeorder implements hook_term_path() so that taxonomy terms, when gathered via phptemplate's call to
$taxonomy = taxonomy_link('taxonomy terms', $node);, link to nodeorder/term/TID instead of taxonomy/term/TID.There's a lot going on here:
I think I can work around this by branching nodeorder, getting rid of my hook_term_path implementation, and, instead, implement hook_link_alter. I don't have a problem with this, if that's what you think is the best solution. It just seems like this is pointing out some minor inconsistencies in taxonomy's handling of generating term paths, and a possibly unnecessary dependency between phptemplate and taxonomy.
Thanks for taking the time to respond, Moshe.
Marc
Comment #5
dmhouse commentedJust reported a duplicate of this bug, http://drupal.org/node/176371 (which I'm closing). My approach (attached) was similar to your patch, but didn't remove the first line of code, so that when you create vocabularies with OG Vocab, they still get a 'module' of 'og_vocab'. My code also swapped from a LEFT JOIN to an INNER JOIN. This should make sure that no rows in {vocabulary} without a row in {og_vocab} get returned. Technically we were okay with the LEFT JOIN, as we were also doing a 'WHERE ov.nid != %', and doing anything with a NULL value, even !=, is always NULL (if I recall correctly). However using an INNER JOIN is more appropriate.
Comment #6
moshe weitzman commentedComment #7
amitaibuI actually didn't handle this case - if one assigns a group via admin/taxonomy it's registered under 'taxonomy' not 'og_vocab'.
@Moshe,
Are you ok with registering everything under 'taxonomy' and use another the query to get all og_vocabs?
Comment #8
moshe weitzman commentedI have no particular opinion anymore. This is a half baked section of taxonomy module. If it makes life easier, i am OK with all vocabs being owned by taxonomy.
Comment #9
marcp commentedThe only taxonomy code that cares about the module field in the vocabulary table is in
taxonomy_term_path(). A quick search for taxonomy_term_path gives a decent sized list of issues related to this.Seems like the new best way to deal with this is probably to call
drupal_alter()when generating taxonomy links and get rid of the module field in the vocabulary table.Comment #10
moshe weitzman commentedTaxonomy links on nodes are now added to $node->content and are currently alterable via nodeapi('alter') and even if that goes away (as i have proposed), once can add a #pre_render handler and adjust the links as needed.
Comment #11
amitaibuVocabs now belong to 'taxonomy' - http://drupal.org/cvs?commit=160794