You are here

function _file_entity_entity_fields_update in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 file_entity.file.inc \_file_entity_entity_fields_update()

Update an entity's field values without changing anything on the entity.

1 call to _file_entity_entity_fields_update()
_file_entity_update_image_field_dimensions in ./file_entity.file.inc
Update the image dimensions stored in any image fields for a file.

File

./file_entity.file.inc, line 372
File hooks implemented by the File entity module.

Code

function _file_entity_entity_fields_update($entity_type, $entity) {
  list($id) = entity_extract_ids($entity_type, $entity);
  if (empty($id)) {
    throw new Exception(t('Cannot call _file_entity_update_entity_fields() on a new entity.'));
  }

  // Some modules use the original property.
  if (!isset($entity->original)) {
    $entity->original = $entity;
  }

  // Ensure that file_field_update() will not trigger additional usage.
  unset($entity->revision);

  // Invoke the field presave and update hooks.
  field_attach_presave($entity_type, $entity);
  field_attach_update($entity_type, $entity);

  // Clear the cache for this entity now.
  entity_get_controller($entity_type)
    ->resetCache(array(
    $id,
  ));
}