You are here

function hook_field_entity_dependencies in Entity Dependency API 7

This is not a real hook (as the other Field API hooks). This hook is called for each module owner of a field. But it has the same intention as hook_entity_dependencies() but is more suited for defining dependencies for certain fields.

Below is an example. Taxonomy module owns one field (the taxonomy term reference field), hence it's called for all instances of that field.

See also

hook_entity_dependencies()

7 functions implement hook_field_entity_dependencies()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entityreference_field_entity_dependencies in ./entity_dependency.core.inc
Implements hook_field_entity_dependencies().
field_collection_field_entity_dependencies in ./entity_dependency.core.inc
Implements hook_field_entity_dependencies().
file_field_entity_dependencies in ./entity_dependency.core.inc
Implements hook_field_entity_dependencies().
image_field_entity_dependencies in ./entity_dependency.core.inc
Implements hook_field_entity_dependencies().
node_reference_field_entity_dependencies in ./entity_dependency.core.inc
Implements hook_field_entity_dependencies().

... See full list

1 invocation of hook_field_entity_dependencies()
field_entity_dependencies in ./entity_dependency.core.inc
Implements hook_entity_dependencies().

File

./entity_dependency.api.php, line 64
Hooks provided by the Entity Dependency module.

Code

function hook_field_entity_dependencies($entity_type, $entity, $field, $instance, $langcode, $items) {

  // No need to check for the field type here, since this hook is only called
  // for the owner of this field. Taxonomy module only owns one field.
  $dependencies = array();
  entity_dependency_add($dependencies, $items, 'taxonomy_term', 'tid');
  return $dependencies;
}