Mercurial > hg > cmmr2012-drupal-site
view vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete.twig @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
line wrap: on
line source
/** * Implements hook_field_delete(). */ function {{ machine_name }}_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items) { list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); foreach ($items as $delta => $item) { // For hook_file_references(), remember that this is being deleted. $item['file_field_name'] = $field['field_name']; // Pass in the ID of the object that is being removed so all references can // be counted in hook_file_references(). $item['file_field_type'] = $entity_type; $item['file_field_id'] = $id; file_field_delete_file($item, $field, $entity_type, $id); } }