diff --git a/admin_theme.module b/admin_theme.module
index 99b0cde..a64f0c8 100644
--- a/admin_theme.module
+++ b/admin_theme.module
@@ -4,7 +4,8 @@
  * @file
  * Admin Theme Hook Implementations.
  */
-
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\admin_theme\Hook\AdminThemeHooks;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Form\FormStateInterface;
 
@@ -13,32 +14,10 @@ use Drupal\Core\Form\FormStateInterface;
  *
  * @see admin_theme_form_system_themes_form_alter_submit()
  */
-function admin_theme_form_system_themes_admin_form_alter(&$form, FormStateInterface $form_state, $form_id) {
-  // Include paths.
-  $paths = \Drupal::configFactory()->getEditable('admin_theme.settings')->get('paths');
-  /** @var \Drupal\Core\Condition\ConditionInterface $condition */
-  $condition = \Drupal::service('plugin.manager.condition')->createInstance('request_path', ['pages' => $paths]);
-  $form_state->set(['conditions', 'admin_theme_request_path'], $condition);
-
-  $form['admin_theme']['admin_theme_request_path'] = $condition->buildConfigurationForm([], $form_state);
-  $form['admin_theme']['admin_theme_request_path']['#tree'] = TRUE;
-  $form['admin_theme']['admin_theme_request_path']['#type'] = 'fieldset';
-  $form['admin_theme']['admin_theme_request_path']['#title'] = t('Include');
-  unset($form['admin_theme']['admin_theme_request_path']['negate']);
-
-  // Exclude paths.
-  $paths = \Drupal::configFactory()->getEditable('admin_theme.settings')->get('exclude_paths');
-  /** @var \Drupal\Core\Condition\ConditionInterface $condition */
-  $condition = \Drupal::service('plugin.manager.condition')->createInstance('request_path', ['pages' => $paths]);
-  $form_state->set(['conditions', 'admin_theme_exclude_path'], $condition);
-
-  $form['admin_theme']['admin_theme_exclude_path'] = $condition->buildConfigurationForm([], $form_state);
-  $form['admin_theme']['admin_theme_exclude_path']['#tree'] = TRUE;
-  $form['admin_theme']['admin_theme_exclude_path']['#type'] = 'fieldset';
-  $form['admin_theme']['admin_theme_exclude_path']['#title'] = t('Exclude');
-  unset($form['admin_theme']['admin_theme_exclude_path']['negate']);
-
-  $form['#submit'][] = 'admin_theme_form_system_themes_form_alter_submit';
+#[LegacyHook]
+function admin_theme_form_system_themes_admin_form_alter(&$form, FormStateInterface $form_state, $form_id)
+{
+    \Drupal::service(AdminThemeHooks::class)->formSystemThemesAdminFormAlter($form, $form_state, $form_id);
 }
 
 /**
diff --git a/admin_theme.services.yml b/admin_theme.services.yml
index dd08076..cb608b0 100644
--- a/admin_theme.services.yml
+++ b/admin_theme.services.yml
@@ -4,3 +4,7 @@ services:
     decorates: router.admin_context
     arguments: ['@admin_theme.admin_context.inner', '@plugin.manager.condition', '@config.factory']
     public: false
+
+  Drupal\admin_theme\Hook\AdminThemeHooks:
+    class: Drupal\admin_theme\Hook\AdminThemeHooks
+    autowire: true
diff --git a/src/Hook/AdminThemeHooks.php b/src/Hook/AdminThemeHooks.php
new file mode 100644
index 0000000..0d8acbc
--- /dev/null
+++ b/src/Hook/AdminThemeHooks.php
@@ -0,0 +1,57 @@
+<?php
+
+namespace Drupal\admin_theme\Hook;
+
+use Drupal\Core\Form\FormState;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for admin_theme.
+ */
+class AdminThemeHooks
+{
+    use StringTranslationTrait;
+    /**
+     * Implements hook_form_FORM_ID_alter() for system_themes_admin_form.
+     *
+     * @see admin_theme_form_system_themes_form_alter_submit()
+     */
+    #[Hook('form_system_themes_admin_form_alter')]
+    public function formSystemThemesAdminFormAlter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
+    {
+        // Include paths.
+        $paths = \Drupal::configFactory()->getEditable('admin_theme.settings')->get('paths');
+        /** @var \Drupal\Core\Condition\ConditionInterface $condition */
+        $condition = \Drupal::service('plugin.manager.condition')->createInstance('request_path', [
+            'pages' => $paths,
+        ]);
+        $form_state->set([
+            'conditions',
+            'admin_theme_request_path',
+        ], $condition);
+        $form['admin_theme']['admin_theme_request_path'] = $condition->buildConfigurationForm([
+        ], $form_state);
+        $form['admin_theme']['admin_theme_request_path']['#tree'] = TRUE;
+        $form['admin_theme']['admin_theme_request_path']['#type'] = 'fieldset';
+        $form['admin_theme']['admin_theme_request_path']['#title'] = $this->t('Include');
+        unset($form['admin_theme']['admin_theme_request_path']['negate']);
+        // Exclude paths.
+        $paths = \Drupal::configFactory()->getEditable('admin_theme.settings')->get('exclude_paths');
+        /** @var \Drupal\Core\Condition\ConditionInterface $condition */
+        $condition = \Drupal::service('plugin.manager.condition')->createInstance('request_path', [
+            'pages' => $paths,
+        ]);
+        $form_state->set([
+            'conditions',
+            'admin_theme_exclude_path',
+        ], $condition);
+        $form['admin_theme']['admin_theme_exclude_path'] = $condition->buildConfigurationForm([
+        ], $form_state);
+        $form['admin_theme']['admin_theme_exclude_path']['#tree'] = TRUE;
+        $form['admin_theme']['admin_theme_exclude_path']['#type'] = 'fieldset';
+        $form['admin_theme']['admin_theme_exclude_path']['#title'] = $this->t('Exclude');
+        unset($form['admin_theme']['admin_theme_exclude_path']['negate']);
+        $form['#submit'][] = 'admin_theme_form_system_themes_form_alter_submit';
+    }
+}
