Patch allows an implementing handler to act upon field change, e.g. act on hook_field_presave()

This patch is still not finished, as there are other operations that need to be invoked (all ops from _invoke_field), but I'm setting to needs review to see if this approach is acceptable.

My use case, is that OG can provide own handler with own field_validate| insert| update logic.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

Added insert/ update/ delete.

amitaibu’s picture

@Damz, I've implemented this in OG7's new dev branch. Can you please let me know if it's an acceptable improvement?

Damien Tournoud’s picture

So we have rewrote the Field API as a CTools plugin? :)

Yes, this is acceptable. I'm not a fan of the implementation, could we convert that into a single call_user_func_array()? The signature of the entityreference_field_invoke_handler() scares me.

amitaibu’s picture

I've also added hook_field_load() -- My use case is here (although I'm not sure if it is indeed what OG will do in the end)

The patch doesn't work, because, well a bit embarrassing... but I didn't find how to pass the values by reference using call_user_func_array() :/ -- what am I missing there?

amitaibu’s picture

Ok, fixed the reference issue ;)

amitaibu’s picture

> My use case is here (although I'm not sure if it is indeed what OG will do in the end)

Answering myself: It's actually looking pretty promising, so yes, hook_field_load() is also needed :)

Status: Needs review » Needs work

The last submitted patch, 1343918-er-invoke-field-handler-5.patch, failed testing.

amitaibu’s picture

Status: Needs work » Closed (duplicate)