I often write modules that depend on a specific vocabulary for some integral part of the module's behavior. This always precipitates the need to map the vocabulary to the module, usually in the module's settings. OR, some modules create the vocabulary from scratch. Both of these could be automated if the taxonomy module had a function that modules could call to create and register a vocabulary with a module. This would also presumably give modules a way to query which vocabulary they were mapped to for a specific purpose.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | taxonomy.respect.patch.20060214 | 547 bytes | mfredrickson |
Comments
Comment #1
mfredrickson commentedThis feature is 1/2 there already. Vocabs can be owned by a module, but taxonomy doesn't respect that ownership.
Attached is a patch that makes taxonomy play nice with other modules by not including their vocabularies in the overall list on every node.
Frankly, I don't love this solution, but I can't find a way to invoke hook_form_alter on the "categories" subsection of the node_edit form. Additionally, I can't guarantee that my module will run after taxonomy, and thus have access to the changes made in taxonomy_form_alter.
By forcing taxonomy to play nice, at least we get some ability to stop it from displaying our categories.
I think a logical extension on this patch would be to include which module controls a taxonomy in the 'admin/categories' screen. This would allow people the knowledge that they shouldn't mess with other modules' categories by directly messing with them in the 'admin/categories'
-M
Comment #2
mfredrickson commentedOh and if I wasn't clear before, the ownership is controlled by the 'module' field in the vocabulary table.
Comment #3
benshell commentedAny progress on this? Just curious, as I could use something like this on a module I'm working on.
Comment #4
mfredrickson commentedThis will happen in core after 4.7.
Dries has designated taxonomy as one of several key areas of focus for 4.8.
In the meantime I'm working half heartedly on a module to provide some useful taxonomy helper functions (along with a patch to taxonomy.module to add some more hooks). Lately, I've been questioning whether or not this is a worthwhile task.
I'm waiting until that effort gets underway before doing much more.
-M
Comment #5
Jaza commentedI don't think that hiding non-taxonomy-owned vocabs completely is the right solution. A better alternative would be to move them to a separate table, or to a separate tab.
Moving to 6.x.
Comment #6
catchbumping this to D7.
Comment #7
robin monks commentedIs this still needed?
Comment #8
catchMarking as duplicate of #569326: Add hook_taxonomy_vocabulary_info() which has a more up-to-date patch.