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.

CommentFileSizeAuthor
#1 taxonomy.respect.patch.20060214547 bytesmfredrickson

Comments

mfredrickson’s picture

Status: Active » Needs review
StatusFileSize
new547 bytes

This 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

mfredrickson’s picture

Oh and if I wasn't clear before, the ownership is controlled by the 'module' field in the vocabulary table.

benshell’s picture

Any progress on this? Just curious, as I could use something like this on a module I'm working on.

mfredrickson’s picture

This 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

Jaza’s picture

Version: x.y.z » 6.x-dev
Status: Needs review » Needs work

I 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.

catch’s picture

Version: 6.x-dev » 7.x-dev

bumping this to D7.

robin monks’s picture

Is this still needed?

catch’s picture

Status: Needs work » Closed (duplicate)

Marking as duplicate of #569326: Add hook_taxonomy_vocabulary_info() which has a more up-to-date patch.