From 8cb52e47c1d0ea1009921c14d585b0194b532ec5 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 22 Apr 2010 22:51:54 +0000 Subject: - Patch #777092 by jhodgdon, puregin: field purge hooks are not documented. --- modules/field/field.api.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'modules/field/field.api.php') diff --git a/modules/field/field.api.php b/modules/field/field.api.php index 95f436c43..da84eb23c 100644 --- a/modules/field/field.api.php +++ b/modules/field/field.api.php @@ -1637,6 +1637,42 @@ function hook_field_read_field($field) { function hook_field_read_instance($instance) { } +/** + * Acts when a field record is being purged. + * + * In field_purge_field(), after the field configuration has been + * removed from the database, the field storage module has had a chance to + * run its hook_field_storage_purge_field(), and the field info cache + * has been cleared, this hook is invoked on all modules to allow them to + * respond to the field being purged. + * + * @param $field + * The field being purged. + */ +function hook_field_purge_field($field) { + db_delete('my_module_field_info') + ->condition('id', $field['id']) + ->execute(); +} + +/** + * Acts when a field instance is being purged. + * + * In field_purge_instance(), after the field instance has been + * removed from the database, the field storage module has had a chance to + * run its hook_field_storage_purge_instance(), and the field info cache + * has been cleared, this hook is invoked on all modules to allow them to + * respond to the field instance being purged. + * + * @param $instance + * The instance being purged. + */ +function hook_field_purge_field_instance($instance) { + db_delete('my_module_field_instance_info') + ->condition('id', $instance['id']) + ->execute(); +} + /** * @} End of "ingroup field_crud" */ -- cgit v1.2.3