1 file.file.inc | _file_fields_update($entity_type, $entity) |
Update an entity's field values without changing anything on the entity.
File
- core/
modules/ file/ file.file.inc, line 261 - File hooks implemented by the File module.
Code
function _file_fields_update($entity_type, $entity) {
$id = $entity->id();
if (empty($id)) {
throw new Exception(t('Cannot call _file_fields_update() 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));
}