1 entityreference.module entityreference_entity_crud($entity, $entity_type, $method_name)

Invoke a behavior based on entity CRUD.

Parameters

$entity: The entity object.

$entity_type: The entity type.

$method_name: The method to invoke.

File

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

Code

function entityreference_entity_crud($entity, $entity_type, $method_name) {
  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->{$method_name}($entity_type, $entity, $field, $instance);
      }
    }
  }
}