Unverified Commit b5fa4db9 authored by Lucas Hedding's avatar Lucas Hedding Committed by Lucas Hedding
Browse files

Issue #3382350 by heddn: hook_field_widget_form_alter deprecation

parent e2769344
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
name: EXIF Orientation
type: module
description: 'Rotates images per their EXIF Orientation'
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^9.2 || ^10
package: 'Media'
+2 −2
Original line number Diff line number Diff line
@@ -18,13 +18,13 @@ function exif_orientation_file_presave(EntityInterface $entity) {
}

/**
 * Implements hook_field_widget_form_alter().
 * Implements hook_field_widget_single_element_form_alter().
 *
 * Add a custom validator before file_validate_image_resolution().
 * file_validate_image_resolution resizes the image if it's too large losing the
 * exif data in the process.
 */
function exif_orientation_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) {
function exif_orientation_field_widget_single_element_form_alter(&$element, FormStateInterface $form_state, $context) {
  if(isset($element['#upload_validators']['file_validate_image_resolution'])){
    $element['#upload_validators'] = ['exif_orientation_validate_image_rotation' => []] + $element['#upload_validators'];
  }