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().

#1 1473024-post-insert-update-delete.patch5.05 KBDamien Tournoud
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Damien Tournoud’s picture

Status: Active » Needs review
5.05 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es). View

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


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