Now that #306224: EOL Taxonomy sprint: add proper taxonomy term hooks is in, hook_taxonomy() (yes, it exists!) needs to become hook_taxonomy_vocabulary_load/save/delete/update

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Status: Active » Needs review
FileSize
11.44 KB

This adds the hooks, and brings the function naming into line with #314147: DX: Standardise taxonomy load/save/delete functions on objects.

catch’s picture

Title: hook_taxonomy($op) should be hook_taxonomy_vocabulary_$op » Make vocabulary load/insert/update/save like terms

Better description.

pwolanin’s picture

Looks reasonable - will test.

pwolanin’s picture

Status: Needs review » Needs work

we should abolish the possibility that taxonomy_vocabulary_save() will delete the vocabulary - what an abomination in any API. Also some problems like this w/ forum module needed fixing: Fatal error: Call to undefined function taxonomy_save_vocabulary() in forum.install

After testing - the above patch totally borks forum module due to the calling function not being able to get the vid back after saving a vocabulary.

pwolanin’s picture

Status: Needs work » Needs review
FileSize
18.84 KB

ok, a more thorough cleanup - I think the vocabulary is now consistently treated as an object and the forum module and forum and taxonomy tests are unbroken.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Much better. pwolanin went where I feared to tread in taxonomy.test. Nice find that it's the only place which uses the 'if the vocabulary name is empty, delete it', logic.

There's so, much, more, cleanup that needs to be done in taxonomy module. But let's get this in so we can keep going with it.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Looks good, and tests pass. Committed to CVS HEAD. Thanks.

catch’s picture

Status: Fixed » Needs work

Thanks Dries.

Marking to needs work since I need to fix update and API docs for this.

catch’s picture

Status: Needs work » Fixed

I've updated the core/hooks.php and the update documentation, so this back to fixed :)

Status: Fixed » Closed (fixed)

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