summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-04-24 07:19:09 +0000
committerDries Buytaert <dries@buytaert.net>2010-04-24 07:19:09 +0000
commit237b0da86c3a4d934353a9c3076cdfeaa56cb5d8 (patch)
treed080eb6708c578487625932356f4b61ed930cdcf /modules
parent3e533eb32324a9b59aaed974686b1ccfa52f03e7 (diff)
downloadbrdo-237b0da86c3a4d934353a9c3076cdfeaa56cb5d8.tar.gz
brdo-237b0da86c3a4d934353a9c3076cdfeaa56cb5d8.tar.bz2
- Patch #776694 by puregin, robeano, aspilicious: hook_field_attach_purge() is not documented.
Diffstat (limited to 'modules')
-rw-r--r--modules/field/field.api.php27
-rw-r--r--modules/field/field.crud.inc2
2 files changed, 28 insertions, 1 deletions
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index 443438760..71c97fe50 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -1050,6 +1050,33 @@ function hook_field_attach_delete_revision($entity_type, $entity) {
}
/**
+ * Act on field_purge_data.
+ *
+ * This hook is invoked in field_purge_data() and allows modules to act on
+ * purging data from a single field pseudo-entity. For example, if a module
+ * relates data in the field with its own data, it may purge its own data
+ * during this process as well.
+ *
+ * @param $entity_type
+ * The type of $entity; e.g. 'node' or 'user'.
+ * @param $entity
+ * The pseudo-entity whose field data is being purged.
+ * @param $field
+ * The (possibly deleted) field whose data is being purged.
+ * @param $instance
+ * The deleted field instance whose data is being purged.
+ *
+ * @see @link field_purge Field API bulk data deletion @endlink
+ * @see field_purge_data()
+ */
+function hook_field_attach_purge($entity_type, $entity, $field, $instance) {
+ // find the corresponding data in mymodule and purge it
+ if($entity_type == 'node' && $field->field_name == 'my_field_name') {
+ mymodule_remove_mydata($entity->nid);
+ }
+}
+
+/**
* Act on field_attach_view.
*
* This hook is invoked after the field module has performed the operation.
diff --git a/modules/field/field.crud.inc b/modules/field/field.crud.inc
index d63dfdada..8150c975c 100644
--- a/modules/field/field.crud.inc
+++ b/modules/field/field.crud.inc
@@ -1040,7 +1040,7 @@ function field_purge_batch($batch_size) {
* @param $entity_type
* The type of $entity; e.g. 'node' or 'user'.
* @param $entity
- * The pseudo-entity whose field data to delete.
+ * The pseudo-entity whose field data is being purged.
* @param $field
* The (possibly deleted) field whose data is being purged.
* @param $instance