1 entityreference.module entityreference_field_attach_insert($entity_type, $entity)

Implements hook_field_attach_insert().

Emulates a post-insert hook.

File

core/modules/entityreference/entityreference.module, line 241
Entityreference primary module file.

Code

function entityreference_field_attach_insert($entity_type, $entity) {
  list(, , $bundle) = entity_extract_ids($entity_type, $entity);
  foreach (field_info_instances($entity_type, $bundle) as $field_name => $instance) {
    $field = field_info_field($field_name);
    if ($field['type'] == 'entityreference') {
      foreach (entityreference_get_behavior_handlers($field, $instance) as $handler) {
        $handler->postInsert($entity_type, $entity, $field, $instance);
      }
    }
  }
}