Related issue opened on the Focal Point module:
https://www.drupal.org/project/focal_point/issues/3008727
I'm running into an issue when both the Focal Point and File (Field) Paths modules are enabled on an image field. In particular, it would appear that when I initially upload a file, set the focal point, and save the node, Focal Point isn't saving correct values.
However, if I open the Node, set the focal point, and re-save, things seem to work as expected. Disabling File (Field) Paths on the image field while keeping Focal Point also resolves the issue, which makes me curious if File (Field) Paths might be the culprit.
Specific info about my setup.
- Drupal Version: 8.6.3
- Focal Point Version: 8.x-1.0-beta6
- File (Field) Paths Version: 8.x-1.0-beta1
I've also been able to replicate this on fresh installs of Drupal, so I don't think it's specific to my environment. If anyone else could replicate this, I would be very happy to know that I'm not going crazy off this though :)
A related issue I found long ago, but it looks like this was resolved and not entirely related maybe: https://www.drupal.org/project/filefield_paths/issues/2757285
Issue fork filefield_paths-3015137
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nikitas commentedI had the same issue. I have solved this by checking the filefields_paths_entity_update hook and modifying it in my custom module like this:
Comment #3
volegerComment #4
justcaldwellApplying the patch in #3042259: Focal point location is not saved if others module change URI on first save. resolved this for us.
Comment #7
decipheredThis one is on us, so it is fixed here rather than in Focal Point.
When a file is moved into its token based path, the field item still points at the pre-move file. Focal Point reads the field item immediately after us and saves its crop against a location that no longer exists, which is why the position is lost on the first save and correct on the second. Any module that reads a file path after us hits the same thing.
MR !75 points the field item at the moved file, with kernel tests covering it. There is no dependency on Focal Point or Crop.
Worth noting that https://www.drupal.org/i/3042259 is still Needs Review, so the patch people have been applying has not shipped. The two fixes are complementary and both are worth having.
Credit to Nuuou for the report and reproduction, tvhung for finding the cause in 2019, nikitas for the workaround, and justcaldwell for confirming it and opening the Focal Point MR.