Commit d6f88237 authored by attilatilman's avatar attilatilman Committed by Pravin Gaikwad
Browse files

Issue #3295940 by attilatilman, ankitv18, ameymudras, Rajeshreeputra: Drupal 10 compatibility fixes

parent dbe48599
Loading
Loading
Loading
Loading
+1 −4
Changes for composer.json: 1 added line, 4 removed lines.
Original line number Diff line number Diff line
@@ -22,8 +22,5 @@
      "type": "composer",
      "url": "https://packages.drupal.org/8"
    }
  ],
  "require": {
    "drupal/crop": "^1.0 || ^2.0"
  }
  ]
}
+2 −1
Changes for focal_point.info.yml: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
name: Focal Point
type: module
description: Allows users to specify the focal point of an image for use during cropping.
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^9.3 || ^10
package: Media
test_dependencies:
  - crop:crop
dependencies:
  - drupal:image
  - crop:crop
  - jquery_ui_draggable:jquery_ui_draggable
+3 −3
Changes for focal_point.install: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ function focal_point_update_8001() {
 * Migrates legacy values to crop entities.
 */
function focal_point_update_8002(&$sandbox) {
  /** @var \Drupal\file\FileUsage\FileUsageInterface $file_usage */
  $file_storage = \Drupal::entityTypeManager()->getStorage('file');
  $crop_storage = \Drupal::entityTypeManager()->getStorage('crop');
  $crop_type = \Drupal::config('focal_point.settings')->get('crop_type');
@@ -53,8 +52,9 @@ function focal_point_update_8002(&$sandbox) {
    ->fetchAll();

  foreach ($focal_points as $focal_point) {
    $fid = $focal_point->fid;
    /** @var \Drupal\file\FileInterface $file */
    $file = $file_storage->load($focal_point->fid);
    $file = $file_storage->load($fid);

    if (!is_null($file)) {
      $size = getimagesize($file->getFileUri());
@@ -76,7 +76,7 @@ function focal_point_update_8002(&$sandbox) {
    else {
      $sandbox['num_skipped']++;
    }
    $sandbox['last_fid'] = $focal_point->fid;
    $sandbox['last_fid'] = $fid;
  }

  $sandbox['#finished'] = $sandbox['total_items'] ? ($sandbox['num_processed'] + $sandbox['num_skipped']) / $sandbox['total_items'] : 1;
+2 −2
Changes for focal_point.libraries.yml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -7,8 +7,8 @@ drupal.focal_point:
      css/focal_point.css: {}
  dependencies:
    - core/jquery
    - core/jquery.ui
    - core/jquery.ui.draggable
    - jquery_ui/core
    - jquery_ui_draggable/draggable
    - core/drupal

drupal.focal_point_preview:
+4 −1
Changes for focal_point.module: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\file\FileInterface;
use Drupal\crop\CropInterface;

/**
 * Implements hook_help().
@@ -87,7 +88,9 @@ function focal_point_entity_update(EntityInterface $entity) {
            if (!$crop->get('x')->isEmpty() && !$crop->get('y')->isEmpty()) {
              $x = $crop->get('x')->value;
              $y = $crop->get('y')->value;
              $focal_point_original = $focal_point_manager->absoluteToRelative($x, $y, $item->width, $item->height);
              $width = $item->width ?? 0;
              $height = $item->height ?? 0;
              $focal_point_original = $focal_point_manager->absoluteToRelative($x, $y, $width, $height);
              $entity->{$field->getName()}->focal_point_original = join(',', $focal_point_original);
            }
          }
Loading