All entities in core should have hooks at all the places they invoke field_attach ops, otherwise there's an imbalance in the API.

I would've posted this earlier but I thought the hook existed already, then when I wanted it, it wasn't there :(

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nagba’s picture

+1

Dave Reid’s picture

Status: Needs review » Reviewed & tested by the community
catch’s picture

taxonomy_term_presave.patch queued for re-testing.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

This looks like it's pretty clearly an oversight in the existing API implementation, rather than a new addition, so committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)

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

mikeytown2’s picture

Title: hook_taxonomy() is missing 'presave' - 7.x Backport from taxonomy_term_save() » hook_taxonomy() is missing presave
Status: Needs review » Active

Need to back port this for a shared taxonomy project/module. Patch to come soon, don't expect this to get into core, but since this is in 7.x I don't feel as bad hacking core. The module will be be released on d.o once I create it.
http://api.drupal.org/api/function/taxonomy_save_term/6
http://api.drupal.org/api/function/taxonomy_save_vocabulary/6
http://api.drupal.org/api/function/hook_taxonomy/6

mikeytown2’s picture

Title: hook_taxonomy_term_presave() is missing » hook_taxonomy() is missing 'presave'
Version: 7.x-dev » 6.x-dev
Category: bug » feature
Status: Closed (fixed) » Needs review
FileSize
2.84 KB

Added in missing/better documentation for the above 2 functions.

mikeytown2’s picture

Title: hook_taxonomy() is missing 'presave' » hook_taxonomy() is missing 'presave' - 7.x Backport from taxonomy_term_save()
FileSize
2.85 KB

fixed a dumb error in the documentation

mikeytown2’s picture

Title: hook_taxonomy() is missing presave » hook_taxonomy() is missing 'presave' - 7.x Backport from taxonomy_term_save()
Status: Active » Needs review

lame... D6 uses arrays which do not get passed by reference, so this hook in its current form doesn't work for D6.

mikeytown2’s picture

FileSize
2.87 KB

Due to the requirement of a return value I'm no longer using hook_taxonomy. Using d7 naming conventions in d6.
hook_taxonomy_vocabulary_presave()
hook_taxonomy_term_presave()

mikeytown2’s picture

Title: hook_taxonomy() is missing 'presave' - 7.x Backport from taxonomy_term_save() » hook_taxonomy_term_presave() is missing
Version: 6.x-dev » 7.x-dev
Category: feature » bug
Status: Needs review » Closed (fixed)
FileSize
1.6 KB

this change is too big, putting this back to 7.x

Here is the patch I decided to use for 6.x though.

mikeytown2’s picture

Re-rolled #11 for git