diff --git a/filefield_paths.module b/filefield_paths.module index ff4e32a..fbbfebf 100644 --- a/filefield_paths.module +++ b/filefield_paths.module @@ -238,6 +238,12 @@ function filefield_paths_entity_update($entity, $type) { } $files[] = &$file; } + } + + // Store the original entity before we modify it + $entity->original = $entity; + + foreach ($entity->{$field['field_name']} as $langcode => $deltas) { // Invoke hook_filefield_paths_process_file(). foreach (module_implements('filefield_paths_process_file') as $module) { if (function_exists($function = "{$module}_filefield_paths_process_file")) { @@ -257,7 +263,6 @@ function filefield_paths_entity_update($entity, $type) { $entity->revision = FALSE; } // Save any changes back to the database. - $entity->original = isset($entity->original) ? $entity->original : NULL; field_attach_update($type, $entity); if (isset($entity->revision)) { // Restore revision flag so that other modules can process it if needed.