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

Comments

Nuuou created an issue. See original summary.

nikitas’s picture

I 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:


use Drupal\media\MediaInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\filefield_paths\Utility\FieldItem;

/**
 * Implements hook_entity_update().
 */
function pixelthis_entity_update(EntityInterface $entity) {

  if (!$entity instanceof MediaInterface || $entity->bundle() !== 'image') {
    return;
  }

  // The filefield_paths module conflicts with the focal_point module.
  // If the filefield_paths module is enabled, we need to disable it
  // for the media.image.field_media_image field.
  // other wise the focal point will not work.
  // https://www.drupal.org/project/filefield_paths/issues/3015137
  $module_handler = \Drupal::moduleHandler();
  foreach ($entity->getFields() as $field) {
    if (FieldItem::hasConfigurationEnabled($field)) {
      $settings = FieldItem::getConfiguration($field);
      // Invoke hook_filefield_paths_process_file().
      $module_handler->invokeAll(
        'filefield_paths_process_file',
        [$entity, $field, $settings]
      );
    }
  }

}

voleger’s picture

Component: Code » Compatibility