You are here

function ref_field_sync_add_reference in (Entity)Reference Field Synchronization 7

Same name and namespace in other branches
  1. 7.2 ref_field_sync.module \ref_field_sync_add_reference()

Remove a ref_field value form an entity

2 calls to ref_field_sync_add_reference()
ref_field_sync_entity_insert in ref_field_sync/ref_field_sync.module
Implements hook_entity_insert().
ref_field_sync_entity_update in ref_field_sync/ref_field_sync.module
Implements hook_entity_update().

File

ref_field_sync/ref_field_sync.module, line 292

Code

function ref_field_sync_add_reference($type, $entity, $eid, $field_name) {
  $lng = isset($entity->language) && $entity->language ? $entity->language : LANGUAGE_NONE;
  $entity->{$field_name}[$lng][]['eid'] = $eid;
  $entity->ref_field_caller = TRUE;

  // Set flag to not process this entity_save again
  entity_save($type, $entity);
}