summaryrefslogtreecommitdiff
path: root/modules/field
diff options
context:
space:
mode:
authorJennifer Hodgdon <yahgrp@poplarware.com>2012-03-30 14:46:31 -0700
committerJennifer Hodgdon <yahgrp@poplarware.com>2012-03-30 14:46:31 -0700
commitd3994552e8e01b122dddd04d37dbd6044ac37d94 (patch)
tree1012eef04fe4cb26b6c3ce0fe19a2d02ab02b58f /modules/field
parentc736984391e491c65153a44e0d519135e71495b2 (diff)
downloadbrdo-d3994552e8e01b122dddd04d37dbd6044ac37d94.tar.gz
brdo-d3994552e8e01b122dddd04d37dbd6044ac37d94.tar.bz2
Issue #1440834 by nmudgal: Add clarity and information to docs for hook_field_delete/update/insert
Diffstat (limited to 'modules/field')
-rw-r--r--modules/field/field.api.php37
1 files changed, 30 insertions, 7 deletions
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index 774d8b55e..cb55bba16 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -426,9 +426,14 @@ function hook_field_presave($entity_type, $entity, $field, $instance, $langcode,
}
/**
- * Define custom insert behavior for this module's field types.
+ * Define custom insert behavior for this module's field data.
*
- * Invoked from field_attach_insert().
+ * This hook is invoked from field_attach_insert() on the module that defines a
+ * field, during the process of inserting an entity object (node, taxonomy term,
+ * etc.). It is invoked just before the data for this field on the particular
+ * entity object is inserted into field storage. Only field modules that are
+ * storing or tracking information outside the standard field storage mechanism
+ * need to implement this hook.
*
* @param $entity_type
* The type of $entity.
@@ -442,6 +447,9 @@ function hook_field_presave($entity_type, $entity, $field, $instance, $langcode,
* The language associated with $items.
* @param $items
* $entity->{$field['field_name']}[$langcode], or an empty array if unset.
+ *
+ * @see hook_field_update()
+ * @see hook_field_delete()
*/
function hook_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
if (variable_get('taxonomy_maintain_index_table', TRUE) && $field['storage']['type'] == 'field_sql_storage' && $entity_type == 'node' && $entity->status) {
@@ -459,9 +467,14 @@ function hook_field_insert($entity_type, $entity, $field, $instance, $langcode,
}
/**
- * Define custom update behavior for this module's field types.
+ * Define custom update behavior for this module's field data.
*
- * Invoked from field_attach_update().
+ * This hook is invoked from field_attach_update() on the module that defines a
+ * field, during the process of updating an entity object (node, taxonomy term,
+ * etc.). It is invoked just before the data for this field on the particular
+ * entity object is updated into field storage. Only field modules that are
+ * storing or tracking information outside the standard field storage mechanism
+ * need to implement this hook.
*
* @param $entity_type
* The type of $entity.
@@ -475,6 +488,9 @@ function hook_field_insert($entity_type, $entity, $field, $instance, $langcode,
* The language associated with $items.
* @param $items
* $entity->{$field['field_name']}[$langcode], or an empty array if unset.
+ *
+ * @see hook_field_insert()
+ * @see hook_field_delete()
*/
function hook_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) {
if (variable_get('taxonomy_maintain_index_table', TRUE) && $field['storage']['type'] == 'field_sql_storage' && $entity_type == 'node') {
@@ -540,10 +556,14 @@ function hook_field_storage_update_field($field, $prior_field, $has_data) {
}
/**
- * Define custom delete behavior for this module's field types.
+ * Define custom delete behavior for this module's field data.
*
- * This hook is invoked just before the data is deleted from field storage
- * in field_attach_delete().
+ * This hook is invoked from field_attach_delete() on the module that defines a
+ * field, during the process of deleting an entity object (node, taxonomy term,
+ * etc.). It is invoked just before the data for this field on the particular
+ * entity object is deleted from field storage. Only field modules that are
+ * storing or tracking information outside the standard field storage mechanism
+ * need to implement this hook.
*
* @param $entity_type
* The type of $entity.
@@ -557,6 +577,9 @@ function hook_field_storage_update_field($field, $prior_field, $has_data) {
* The language associated with $items.
* @param $items
* $entity->{$field['field_name']}[$langcode], or an empty array if unset.
+ *
+ * @see hook_field_insert()
+ * @see hook_field_update()
*/
function hook_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);