diff --git a/book_link_weight.info.yml b/book_link_weight.info.yml
index 6246c7f..d347572 100644
--- a/book_link_weight.info.yml
+++ b/book_link_weight.info.yml
@@ -4,4 +4,4 @@ description: Alter the book outline to include a drag and drop link weight.
 package: Book
 dependencies:
   - drupal:book
-core_version_requirement: ^8 || ^9 || ^10 || ^11
+core_version_requirement: ^10.1 || ^11 || ^12
diff --git a/book_link_weight.module b/book_link_weight.module
index a5adf0f..0382bf1 100644
--- a/book_link_weight.module
+++ b/book_link_weight.module
@@ -4,29 +4,22 @@
  * @file
  * Hooks to enhance the book with a bool link weight interface.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\book_link_weight\Hook\BookLinkWeightHooks;
 use Drupal\Core\Form\FormStateInterface;
 
 /**
  * Implements hook_form_NODE_FORM_alter().
  */
+#[LegacyHook]
 function book_link_weight_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
-  if (isset($form['book'])) {
-    \Drupal::service('book_link_weight.form')->alterBookOutlineForm($form, $form_state);
-  }
+  \Drupal::service(BookLinkWeightHooks::class)->formNodeFormAlter($form, $form_state, $form_id);
 }
 
 /**
  * Implements hook_form_alter().
  */
+#[LegacyHook]
 function book_link_weight_form_alter(&$form, FormStateInterface $form_state, $form_id) {
-  // If this form is the book outline page then add the weight control
-  // to the form.
-  // Using this method because the book_outline_form does not provide
-  // a base form id.
-  if (substr($form_id, 0, 4) === 'node' && substr($form_id, -17) === 'book_outline_form') {
-    if (isset($form['book'])) {
-      \Drupal::service('book_link_weight.form')->alterBookOutlineForm($form, $form_state);
-    }
-  }
+  \Drupal::service(BookLinkWeightHooks::class)->formAlter($form, $form_state, $form_id);
 }
diff --git a/book_link_weight.services.yml b/book_link_weight.services.yml
index e9a45b2..73b97b2 100644
--- a/book_link_weight.services.yml
+++ b/book_link_weight.services.yml
@@ -1,4 +1,7 @@
 services:
   book_link_weight.form:
     class: Drupal\book_link_weight\Form\BookLinkWeightForm
-    arguments: ['@book.manager']
\ No newline at end of file
+    arguments: ['@book.manager']
+  Drupal\book_link_weight\Hook\BookLinkWeightHooks:
+    class: Drupal\book_link_weight\Hook\BookLinkWeightHooks
+    autowire: true
diff --git a/src/Hook/BookLinkWeightHooks.php b/src/Hook/BookLinkWeightHooks.php
new file mode 100644
index 0000000..cebeb26
--- /dev/null
+++ b/src/Hook/BookLinkWeightHooks.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Drupal\book_link_weight\Hook;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+/**
+ * Hook implementations for book_link_weight.
+ */
+class BookLinkWeightHooks
+{
+    /**
+     * Implements hook_form_NODE_FORM_alter().
+     */
+    #[Hook('form_node_form_alter')]
+    public function formNodeFormAlter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
+    {
+        if (isset($form['book'])) {
+            \Drupal::service('book_link_weight.form')->alterBookOutlineForm($form, $form_state);
+        }
+    }
+    /**
+     * Implements hook_form_alter().
+     */
+    #[Hook('form_alter')]
+    public function formAlter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
+    {
+        // If this form is the book outline page then add the weight control
+        // to the form.
+        // Using this method because the book_outline_form does not provide
+        // a base form id.
+        if (substr($form_id, 0, 4) === 'node' && substr($form_id, -17) === 'book_outline_form') {
+            if (isset($form['book'])) {
+                \Drupal::service('book_link_weight.form')->alterBookOutlineForm($form, $form_state);
+            }
+        }
+    }
+}
