diff --git a/lb_immutable_sections.info.yml b/lb_immutable_sections.info.yml
index 61398f3..7bc477e 100644
--- a/lb_immutable_sections.info.yml
+++ b/lb_immutable_sections.info.yml
@@ -1,4 +1,4 @@
 name: lb_immutable_sections
 type: module
 description: 'LB Immutable sections.'
-core_version_requirement: ^10 || ^11
+core_version_requirement: ^10.1 || ^11 || ^12
diff --git a/lb_immutable_sections.module b/lb_immutable_sections.module
index c014a3a..b7cd6eb 100644
--- a/lb_immutable_sections.module
+++ b/lb_immutable_sections.module
@@ -1,5 +1,7 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\lb_immutable_sections\Hook\LbImmutableSectionsHooks;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\layout_builder\DefaultsSectionStorageInterface;
 use Drupal\layout_builder\Section;
@@ -9,17 +11,10 @@ use Drupal\lb_immutable_sections\RenderCallbacks;
 /**
  * Implements hook_form_FORM_ID_alter().
  */
-function lb_immutable_sections_form_entity_view_display_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) {
-  /** @var \Drupal\Core\Entity\EntityFormInterface $form_object */
-  $form_object = $form_state->getFormObject();
-  /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */
-  $display = $form_object->getEntity();
-  $form['layout']['immutable'] = [
-    '#type' => 'checkbox',
-    '#title' => t('Immutable'),
-    '#default_value' => $display->getThirdPartySetting('lb_immutable_sections', 'immutable', FALSE),
-  ];
-  $form['actions']['submit']['#submit'][] = 'lb_immutable_sections_form_entity_view_display_edit_form_submit';
+#[LegacyHook]
+function lb_immutable_sections_form_entity_view_display_edit_form_alter(&$form, FormStateInterface $form_state, $form_id)
+{
+    \Drupal::service(LbImmutableSectionsHooks::class)->formEntityViewDisplayEditFormAlter($form, $form_state, $form_id);
 }
 
 /**
@@ -37,44 +32,10 @@ function lb_immutable_sections_form_entity_view_display_edit_form_submit(&$form,
 /**
  * Implements hook_form_FORM_ID_alter().
  */
-function lb_immutable_sections_form_layout_builder_configure_section_alter(&$form, FormStateInterface $form_state, $form_id) {
-  // Only apply to default storage.
-  if (!$form_state->getFormObject()->getSectionStorage() instanceof DefaultsSectionStorageInterface) {
-    return;
-  }
-  $currentSection = $form_state->getFormObject()->getCurrentSection();
-  \assert($currentSection instanceof Section);
-  $layoutSettings = $currentSection->getLayoutSettings();
-  $regions = $currentSection->getLayout()->getPluginDefinition()->getRegionNames();
-  $regionLabels = $currentSection->getLayout()->getPluginDefinition()->getRegionLabels();
-  // Add the new form elements for immutable sections.
-  // @todo Check that the display has the immutable setting enabled,
-  // exit early if not.
-  $form['layout_settings']['immutable'] = [
-    '#type' => 'checkbox',
-    '#title' => t('Immutable section'),
-    '#default_value' => $layoutSettings['immutable'] ?? FALSE,
-  ];
-  $form['layout_settings']['immutable_regions'] = [
-    '#type' => 'checkboxes',
-    '#title' => t('Immutable regions'),
-    '#options' => array_combine($regions, $regionLabels),
-    '#default_value' => $layoutSettings['immutable_regions'] ?? [],
-  ];
-  $form['layout_settings']['prevent_sections_before'] = [
-    '#type' => 'checkbox',
-    '#title' => t('Prevent new sections from being added before this section'),
-    '#default_value' => $layoutSettings['prevent_sections_before'] ?? FALSE,
-  ];
-  $form['layout_settings']['prevent_sections_after'] = [
-    '#type' => 'checkbox',
-    '#title' => t('Prevent new sections from being added after this section'),
-    '#default_value' => $layoutSettings['prevent_sections_after'] ?? FALSE,
-  ];
-  $originalSubmit = $form['#submit'];
-  $form['#submit'] = [];
-  $form['#submit'][] = 'lb_immutable_sections_form_layout_builder_configure_section_submit';
-  $form['#submit'] = array_merge($form['#submit'], $originalSubmit);
+#[LegacyHook]
+function lb_immutable_sections_form_layout_builder_configure_section_alter(&$form, FormStateInterface $form_state, $form_id)
+{
+    \Drupal::service(LbImmutableSectionsHooks::class)->formLayoutBuilderConfigureSectionAlter($form, $form_state, $form_id);
 }
 
 /**
@@ -109,16 +70,15 @@ function lb_immutable_sections_form_layout_builder_configure_section_submit(&$fo
 /**
  * Implements hook_layout_builder_section_storage_alter().
  */
+#[LegacyHook]
 function lb_immutable_sections_layout_builder_section_storage_alter(array &$definitions) {
-  // @todo We should consider only overriding this if the immutable setting is enabled.
-  $definitions['overrides']->setClass(ImmutableSectionStorage::class);
+  \Drupal::service(LbImmutableSectionsHooks::class)->layoutBuilderSectionStorageAlter($definitions);
 }
 
 /**
  * Implements hook_element_info_alter().
  */
+#[LegacyHook]
 function lb_immutable_sections_element_info_alter(array &$info) {
-  if (array_key_exists('layout_builder', $info)) {
-    $info['layout_builder']['#pre_render'][] = [RenderCallbacks::class, 'alterLayoutBuilder'];
-  }
+  \Drupal::service(LbImmutableSectionsHooks::class)->elementInfoAlter($info);
 }
diff --git a/lb_immutable_sections.services.yml b/lb_immutable_sections.services.yml
new file mode 100644
index 0000000..33b2701
--- /dev/null
+++ b/lb_immutable_sections.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\lb_immutable_sections\Hook\LbImmutableSectionsHooks:
+    class: Drupal\lb_immutable_sections\Hook\LbImmutableSectionsHooks
+    autowire: true
diff --git a/src/Hook/LbImmutableSectionsHooks.php b/src/Hook/LbImmutableSectionsHooks.php
new file mode 100644
index 0000000..13ec5d0
--- /dev/null
+++ b/src/Hook/LbImmutableSectionsHooks.php
@@ -0,0 +1,103 @@
+<?php
+
+namespace Drupal\lb_immutable_sections\Hook;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\layout_builder\DefaultsSectionStorageInterface;
+use Drupal\layout_builder\Section;
+use Drupal\lb_immutable_sections\Plugin\SectionStorage\ImmutableSectionStorage;
+use Drupal\lb_immutable_sections\RenderCallbacks;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for lb_immutable_sections.
+ */
+class LbImmutableSectionsHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_form_FORM_ID_alter().
+     */
+    #[Hook('form_entity_view_display_edit_form_alter')]
+    public function formEntityViewDisplayEditFormAlter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
+    {
+        /** @var \Drupal\Core\Entity\EntityFormInterface $form_object */
+        $form_object = $form_state->getFormObject();
+        /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */
+        $display = $form_object->getEntity();
+        $form['layout']['immutable'] = [
+            '#type' => 'checkbox',
+            '#title' => $this->t('Immutable'),
+            '#default_value' => $display->getThirdPartySetting('lb_immutable_sections', 'immutable', FALSE),
+        ];
+        $form['actions']['submit']['#submit'][] = 'lb_immutable_sections_form_entity_view_display_edit_form_submit';
+    }
+    /**
+     * Implements hook_form_FORM_ID_alter().
+     */
+    #[Hook('form_layout_builder_configure_section_alter')]
+    public function formLayoutBuilderConfigureSectionAlter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
+    {
+        // Only apply to default storage.
+        if (!$form_state->getFormObject()->getSectionStorage() instanceof \Drupal\layout_builder\DefaultsSectionStorageInterface) {
+            return;
+        }
+        $currentSection = $form_state->getFormObject()->getCurrentSection();
+        assert($currentSection instanceof \Drupal\layout_builder\Section);
+        $layoutSettings = $currentSection->getLayoutSettings();
+        $regions = $currentSection->getLayout()->getPluginDefinition()->getRegionNames();
+        $regionLabels = $currentSection->getLayout()->getPluginDefinition()->getRegionLabels();
+        // Add the new form elements for immutable sections.
+        // @todo Check that the display has the immutable setting enabled,
+        // exit early if not.
+        $form['layout_settings']['immutable'] = [
+            '#type' => 'checkbox',
+            '#title' => $this->t('Immutable section'),
+            '#default_value' => $layoutSettings['immutable'] ?? FALSE,
+        ];
+        $form['layout_settings']['immutable_regions'] = [
+            '#type' => 'checkboxes',
+            '#title' => $this->t('Immutable regions'),
+            '#options' => array_combine($regions, $regionLabels),
+            '#default_value' => $layoutSettings['immutable_regions'] ?? [
+            ],
+        ];
+        $form['layout_settings']['prevent_sections_before'] = [
+            '#type' => 'checkbox',
+            '#title' => $this->t('Prevent new sections from being added before this section'),
+            '#default_value' => $layoutSettings['prevent_sections_before'] ?? FALSE,
+        ];
+        $form['layout_settings']['prevent_sections_after'] = [
+            '#type' => 'checkbox',
+            '#title' => $this->t('Prevent new sections from being added after this section'),
+            '#default_value' => $layoutSettings['prevent_sections_after'] ?? FALSE,
+        ];
+        $originalSubmit = $form['#submit'];
+        $form['#submit'] = [
+        ];
+        $form['#submit'][] = 'lb_immutable_sections_form_layout_builder_configure_section_submit';
+        $form['#submit'] = array_merge($form['#submit'], $originalSubmit);
+    }
+    /**
+     * Implements hook_layout_builder_section_storage_alter().
+     */
+    #[Hook('layout_builder_section_storage_alter')]
+    public function layoutBuilderSectionStorageAlter(array &$definitions)
+    {
+        // @todo We should consider only overriding this if the immutable setting is enabled.
+        $definitions['overrides']->setClass(\Drupal\lb_immutable_sections\Plugin\SectionStorage\ImmutableSectionStorage::class);
+    }
+    /**
+     * Implements hook_element_info_alter().
+     */
+    #[Hook('element_info_alter')]
+    public function elementInfoAlter(array &$info)
+    {
+        if (array_key_exists('layout_builder', $info)) {
+            $info['layout_builder']['#pre_render'][] = [
+                \Drupal\lb_immutable_sections\RenderCallbacks::class,
+                'alterLayoutBuilder',
+            ];
+        }
+    }
+}
