function hook_field_attach_purge
hook_field_attach_purge($entity_type, $entity, $field, $instance)
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.
Parameters
$entity_type: The type of $entity; for example, 'node' or 'user'.
$entity: The pseudo-entity whose field data is being purged.
$field: The (possibly deleted) field whose data is being purged.
$instance: The deleted field instance whose data is being purged.
See also
Related topics
File
- modules/field/field.api.php, line 1475
- Hooks provided by the Field module.
Code
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); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!field.api.php/function/hook_field_attach_purge/7.x