Verified Commit 340ccd3f authored by Dave Long's avatar Dave Long
Browse files

fix: #3609124 Add proper BC for ImageFormatter

By: nicxvan
(cherry picked from commit e455f285)
parent 450c9390
Loading
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -40,9 +40,13 @@ public function __construct(
    protected AccountInterface $currentUser,
    protected EntityStorageInterface $imageStyleStorage,
    protected FileUrlGeneratorInterface $fileUrlGenerator,
    protected ImageDerivativeUtilities $imageDerivativeUtilities,
    protected ?ImageDerivativeUtilities $imageDerivativeUtilities,
  ) {
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
    if (!$imageDerivativeUtilities) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $imageDerivativeUtilities argument is deprecated in drupal:11.4.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/node/3567619', E_USER_DEPRECATED);
      $this->imageDerivativeUtilities = \Drupal::service(ImageDerivativeUtilities::class);
    }
  }

  /**
+5 −1
Original line number Diff line number Diff line
@@ -43,10 +43,14 @@ public function __construct(
    array $third_party_settings,
    EntityTypeManagerInterface $entity_type_manager,
    protected AccountInterface $currentUser,
    protected readonly ImageDerivativeUtilities $imageDerivativeUtilities,
    protected ?ImageDerivativeUtilities $imageDerivativeUtilities,
  ) {
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
    $this->imageStyleStorage = $entity_type_manager->getStorage('image_style');
    if (!$imageDerivativeUtilities) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $imageDerivativeUtilities argument is deprecated in drupal:11.4.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/node/3567619', E_USER_DEPRECATED);
      $this->imageDerivativeUtilities = \Drupal::service(ImageDerivativeUtilities::class);
    }
  }

  /**
+6 −2
Original line number Diff line number Diff line
@@ -42,9 +42,13 @@ public function __construct(
    ImageStyleStorageInterface $image_style_storage,
    FileUrlGeneratorInterface $file_url_generator,
    protected RendererInterface $renderer,
    protected ImageDerivativeUtilities $imageDerivativeUtilities,
    protected ?ImageDerivativeUtilities $imageDerivativeUtilities,
  ) {
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $current_user, $image_style_storage, $file_url_generator, $imageDerivativeUtilities);
    if (!$imageDerivativeUtilities) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $imageDerivativeUtilities argument is deprecated in drupal:11.4.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/node/3567619', E_USER_DEPRECATED);
      $this->imageDerivativeUtilities = \Drupal::service(ImageDerivativeUtilities::class);
    }
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $current_user, $image_style_storage, $file_url_generator, $this->imageDerivativeUtilities);
  }

  /**