You are here

function multifield_field_delete_revision in Multifield 7

Implements hook_field_delete_revision().

1 call to multifield_field_delete_revision()
multifield_field_delete in ./multifield.field.inc
Implements hook_field_delete().

File

./multifield.field.inc, line 432
Field integration for the Multifield module.

Code

function multifield_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, &$items) {
  $machine_name = multifield_extract_multifield_machine_name($field);
  foreach ($items as $delta => $item) {
    $pseudo_entity = _multifield_field_item_to_entity($machine_name, $item);

    // Run each sub-field through hook_field_delete_revision().
    _multifield_field_invoke('delete_revision', $machine_name, 'multifield', $pseudo_entity, $langcode);

    //$items[$delta] = _multifield_field_entity_to_item($pseudo_entity);
  }

  // Invoke hook_field_delete() with the sub-field data attached to a stub of
  // the parent entity.
  $stub_entity = _multifield_create_stub_entity_with_subfield_data($machine_name, $items, array(), $entity_type, $entity, $langcode);
  _multifield_field_invoke('delete_revision', $machine_name, $entity_type, $stub_entity, $langcode);
}