The insert and update hooks that the Field API implements are actually pre-insert and pre-update hooks. This is not what most of the behavior implementations will require.

I suggest we emulate the corresponding post insert hooks implemented via hook_field_attach_insert() and hook_field_attach_update().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
5.05 KB

Here is what I suggest in form of a patch.

I'm going to need that in the Tree module, that needs to react on post-update and insert.

amitaibu’s picture

Minor:

+++ b/plugins/behavior/abstract.incundefined
@@ -80,13 +87,27 @@ interface EntityReference_BehaviorHandler {
+   * Act before inserting an entity reference field.

I think this line is wrong - "after updating"...

amitaibu’s picture

Also, do you think we should change the existing insert/ update to preInsert/ preUpdate for clarity?

Damien Tournoud’s picture

Status: Needs review » Fixed

Merged into 7.x-1.x (with the correction of #2). I don't think we should touch the existing hooks, I would like to break the API as little as possible.

Status: Fixed » Closed (fixed)

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