diff --git a/chartjs_api.module b/chartjs_api.module
index 1b8ba36..91ee9c3 100644
--- a/chartjs_api.module
+++ b/chartjs_api.module
@@ -1,5 +1,12 @@
 <?php
 
+/**
+ * @file
+ */
+
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\chartjs_api\Hook\ChartjsApiHooks;
+
 /**
  * @file
  * Contains chartjs_api.module.
@@ -8,13 +15,7 @@
 /**
  * Implements hook_theme().
  */
+#[LegacyHook]
 function chartjs_api_theme(): array {
-  return [
-    'chartjs_api' => [
-      'variables' => [
-        'graph_type' => NULL,
-        'id' => NULL,
-      ],
-    ],
-  ];
+  return \Drupal::service(ChartjsApiHooks::class)->theme();
 }
diff --git a/chartjs_api.services.yml b/chartjs_api.services.yml
new file mode 100644
index 0000000..45417aa
--- /dev/null
+++ b/chartjs_api.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\chartjs_api\Hook\ChartjsApiHooks:
+    class: Drupal\chartjs_api\Hook\ChartjsApiHooks
+    autowire: true
diff --git a/src/Hook/ChartjsApiHooks.php b/src/Hook/ChartjsApiHooks.php
new file mode 100644
index 0000000..ed47c10
--- /dev/null
+++ b/src/Hook/ChartjsApiHooks.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace Drupal\chartjs_api\Hook;
+
+use Drupal\Core\Hook\Attribute\Hook;
+
+/**
+ * Hook implementations for chartjs_api.
+ */
+class ChartjsApiHooks {
+  /**
+   * @file
+   * Contains chartjs_api.module.
+   */
+
+  /**
+   * Implements hook_theme().
+   */
+  #[Hook('theme')]
+  public function theme(): array {
+    return [
+      'chartjs_api' => [
+        'variables' => [
+          'graph_type' => NULL,
+          'id' => NULL,
+        ],
+      ],
+    ];
+  }
+
+}
