apps icon indicating copy to clipboard operation
apps copied to clipboard

feat: derive image field ID from focal point field ID for dynamic fie…[]

Open iDVB opened this issue 7 months ago • 3 comments

Dynamic Image Field Association for Focal Point App

  • Fixes #9898

Purpose

The Image Focal Point app was previously hardcoded to only work with a sibling field named "image". This limitation made it difficult to use the app with multiple image fields in the same content type. This change enables more flexible field configurations by dynamically deriving the target image field ID from the focal point field's own ID.

Approach

We implemented a new deriveImageFieldId utility function that follows a consistent naming pattern:

  • focalPointimage (maintains backward compatibility)
  • focalPointLargeimageLarge
  • focalPointSomeThingimageSomeThing

All references to the hardcoded IMAGE_FIELD_ID constant were updated to use this dynamic approach, while ensuring backward compatibility for existing implementations.

Testing steps

  1. Add a field of type JSON with ID "focalPoint" and configure the focal point app - verify it works with an "image" field
  2. Add a field of type JSON with ID "focalPointLarge" and configure the focal point app - verify it works with an "imageLarge" field
  3. Add a field of type JSON with ID "focalPointCustom" and configure the focal point app - verify it works with an "imageCustom" field
  4. Check that error handling shows the correct field ID in error messages when target image fields are not found

Breaking Changes

None. This change is fully backward compatible:

  • Existing fields named exactly "focalPoint" will continue to associate with "image" fields
  • The default fallback remains "image" for any unexpected field naming patterns
  • No configuration changes are required for existing implementations

Dependencies and/or References

N/A

Deployment

Standard deployment process applies; no special deployment steps required.

iDVB avatar Jun 06 '25 14:06 iDVB