function entityreference_entity_crud in Entity reference 7
Invoke a behavior based on entity CRUD.
Parameters
$entity: The entity object.
$entity_type: The entity type.
$method_name: The method to invoke.
3 calls to entityreference_entity_crud()
- entityreference_entity_delete in ./
entityreference.module - Implements hook_entity_delete().
- entityreference_entity_insert in ./
entityreference.module - Implements hook_entity_insert().
- entityreference_entity_update in ./
entityreference.module - Implements hook_entity_update().
File
- ./
entityreference.module, line 387 - 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);
}
}
}
}