diff --git a/image_url_formatter.info.yml b/image_url_formatter.info.yml
index 2f5e66d..a6ef70e 100644
--- a/image_url_formatter.info.yml
+++ b/image_url_formatter.info.yml
@@ -2,6 +2,6 @@ name: Image URL Formatter
 type: module
 description: 'Add an URL formatter for image field.'
 package: Field types
-core_version_requirement: '^10 || ^11'
+core_version_requirement: ^10.1 || ^11 || ^12
 dependencies:
   - drupal:image
diff --git a/image_url_formatter.module b/image_url_formatter.module
index ee178cb..9a4dfed 100644
--- a/image_url_formatter.module
+++ b/image_url_formatter.module
@@ -4,24 +4,17 @@
  * @file
  * Hook implementations for the Image URL Formatter module.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\image_url_formatter\Hook\ImageUrlFormatterHooks;
 use Drupal\Core\Link;
 use Drupal\image\Entity\ImageStyle;
 
 /**
  * Implements hook_theme().
  */
+#[LegacyHook]
 function image_url_formatter_theme() {
-  return [
-    'image_url_formatter' => [
-      'variables' => [
-        'item' => NULL,
-        'url' => NULL,
-        'image_style' => NULL,
-        'url_type' => NULL,
-      ],
-    ],
-  ];
+  return \Drupal::service(ImageUrlFormatterHooks::class)->theme();
 }
 
 /**
diff --git a/image_url_formatter.services.yml b/image_url_formatter.services.yml
new file mode 100644
index 0000000..2ca5abe
--- /dev/null
+++ b/image_url_formatter.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\image_url_formatter\Hook\ImageUrlFormatterHooks:
+    class: Drupal\image_url_formatter\Hook\ImageUrlFormatterHooks
+    autowire: true
diff --git a/src/Hook/ImageUrlFormatterHooks.php b/src/Hook/ImageUrlFormatterHooks.php
new file mode 100644
index 0000000..7479514
--- /dev/null
+++ b/src/Hook/ImageUrlFormatterHooks.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Drupal\image_url_formatter\Hook;
+
+use Drupal\Core\Link;
+use Drupal\image\Entity\ImageStyle;
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for image_url_formatter.
+ */
+class ImageUrlFormatterHooks
+{
+    /**
+     * Implements hook_theme().
+     */
+    #[Hook('theme')]
+    public static function theme()
+    {
+        return [
+            'image_url_formatter' => [
+                'variables' => [
+                    'item' => NULL,
+                    'url' => NULL,
+                    'image_style' => NULL,
+                    'url_type' => NULL,
+                ],
+            ],
+        ];
+    }
+}
diff --git a/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php b/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php
index e1c080a..3eaa116 100644
--- a/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/ImageUrlFormatter.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\image_url_formatter\Plugin\Field\FieldFormatter;
 
+use Drupal\Component\Utility\DeprecationHelper;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\FieldItemListInterface;
@@ -133,7 +134,7 @@ class ImageUrlFormatter extends ImageFormatterBase implements ContainerFactoryPl
       ],
       '#default_value' => $this->getSetting('url_type'),
     ];
-    $image_styles = image_style_options(FALSE);
+    $image_styles = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.4.0', fn() => \Drupal::service('Drupal\image\ImageDerivativeUtilities')->styleOptions(FALSE), fn() => image_style_options(FALSE));
     $element['image_style'] = [
       '#title' => $this->t('Image style'),
       '#type' => 'select',
@@ -180,7 +181,7 @@ class ImageUrlFormatter extends ImageFormatterBase implements ContainerFactoryPl
         break;
     }
 
-    $image_styles = image_style_options(FALSE);
+    $image_styles = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.4.0', fn() => \Drupal::service('Drupal\image\ImageDerivativeUtilities')->styleOptions(FALSE), fn() => image_style_options(FALSE));
     // Unset possible 'No defined styles' option.
     unset($image_styles['']);
     // Styles could be lost because of enabled/disabled modules that defines
diff --git a/tests/src/FunctionalJavascript/ImageUrlFormatterTest.php b/tests/src/FunctionalJavascript/ImageUrlFormatterTest.php
index 546ae54..cc83879 100644
--- a/tests/src/FunctionalJavascript/ImageUrlFormatterTest.php
+++ b/tests/src/FunctionalJavascript/ImageUrlFormatterTest.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Tests\image_url_formatter\FunctionalJavascript;
 
+use Drupal\Component\Utility\DeprecationHelper;
 use Drupal\Core\Config\FileStorage;
 use Drupal\Core\Config\InstallStorage;
 use Drupal\Tests\media\FunctionalJavascript\MediaJavascriptTestBase;
@@ -42,10 +43,12 @@ class ImageUrlFormatterTest extends MediaJavascriptTestBase {
     $this->container->get('config.factory')->reset();
 
     // This test is going to test the display, so we need the standalone URL.
-    \Drupal::configFactory()
+    DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.4.0', fn() => \Drupal::configFactory()
+      ->getEditable('media.settings')
+      ->set('standalone_url', TRUE)->save(), fn() => \Drupal::configFactory()
       ->getEditable('media.settings')
       ->set('standalone_url', TRUE)
-      ->save(TRUE);
+      ->save(TRUE));
 
     $this->container->get('router.builder')->rebuild();
   }
