Use constraint instead of function validator

Created on 4 July 2024, 3 months ago
Updated 19 July 2024, 2 months ago

Problem/Motivation

As of Drupal 10.2.0 using function validators is deprecated and a validation constraint must be used instead.

Additionally, the current implementation in hook_field_widget_single_element_form_alter only adds the exif_orientation_validate_image_rotation validator function if the widget already has the file_validate_image_resolution validator function set.

This does not work anymore, because the file_validate_image_resolution validator function has been replaced by the FileImageDimensions validation constraint.

Steps to reproduce

Use this module 8.x-1.4 in Drupal >= 10.2.

Proposed resolution

Implement a validation constraint for image exif orientation and add the new constraint in hook_field_widget_single_element_form_alter if the widget already has the FileImageDimensions constraint set.

Important: The changes in https://www.drupal.org/project/exif_orientation/issues/3401728 🐛 Orientation is no longer fixed if a maximum image resolution is set on the field RTBC are needed additionally for the orientation logic to work properly!

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇦🇹Austria chfoidl Salzburg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024