diff --git a/bootstrap5.install b/bootstrap5.install
index 568e37d..e721609 100644
--- a/bootstrap5.install
+++ b/bootstrap5.install
@@ -11,8 +11,7 @@
 function bootstrap5_update_8100() {
   \Drupal::configFactory()
     ->getEditable('bootstrap5.settings')
-    ->set('b5_top_container_config', '')
-    ->save(TRUE);
+    ->set('b5_top_container_config', '')->save();
 }
 
 /**
@@ -21,6 +20,5 @@ function bootstrap5_update_8100() {
 function bootstrap5_update_8101() {
   \Drupal::configFactory()
     ->getEditable('bootstrap5.settings')
-    ->set('b5_ckeditor_enable', TRUE)
-    ->save(TRUE);
+    ->set('b5_ckeditor_enable', TRUE)->save();
 }
diff --git a/bootstrap5.services.yml b/bootstrap5.services.yml
new file mode 100644
index 0000000..b9b0160
--- /dev/null
+++ b/bootstrap5.services.yml
@@ -0,0 +1,5 @@
+
+services:
+  Drupal\bootstrap5\Hook\Bootstrap5Hooks:
+    class: Drupal\bootstrap5\Hook\Bootstrap5Hooks
+    autowire: true
diff --git a/bootstrap5.theme b/bootstrap5.theme
index 6073e26..b7ecd9b 100644
--- a/bootstrap5.theme
+++ b/bootstrap5.theme
@@ -5,37 +5,29 @@
  * Bootstrap5 theme file.
  */
 
-use Drupal\block\Entity\Block;
-use Drupal\bootstrap5\SettingsManager;
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\bootstrap5\Hook\Bootstrap5Hooks;
+use Drupal\Component\Utility\DeprecationHelper;
+use Drupal\Core\Extension\ThemeSettingsProvider;
 use Drupal\bootstrap5\SubthemeFormManager;
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Render\Element;
-use Drupal\views\Form\ViewsForm;
 use Drupal\views\ViewExecutable;
 
 /**
  * Implements hook_theme_suggestions_HOOK_alter().
  */
+#[LegacyHook]
 function bootstrap5_theme_suggestions_page_alter(array &$suggestions, array $variables) {
-
-  if (isset($_GET['styleguide'])) {
-    $suggestions[] = 'page__styleguide';
-  }
-
-  if (isset($variables['attributes']['data-block']['region'])) {
-    $region = $variables['attributes']['data-block']['region'];
-    $suggestions[] = $variables['theme_hook_original'] . '__' . $region;
-    $suggestions[] = 'menu__' . $region;
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->themeSuggestionsPageAlter($suggestions, $variables);
 }
 
 /**
  * Implements hook_form_FORM_ID_alter().
  */
+#[LegacyHook]
 function bootstrap5_form_system_theme_settings_alter(&$form, FormStateInterface $form_state, $form_id = NULL) {
-  $settings_manager = new SettingsManager(\Drupal::service('theme.manager'));
-  return $settings_manager->themeSettingsAlter($form, $form_state, $form_id);
+  return \Drupal::service(Bootstrap5Hooks::class)->formSystemThemeSettingsAlter($form, $form_state, $form_id);
 }
 
 /**
@@ -61,8 +53,8 @@ function bootstrap5_form_system_theme_settings_subtheme_submit($form, FormStateI
  */
 function bootstrap5_preprocess_html(&$variables) {
   // Body colour theme.
-  $variables['b5_body_schema'] = theme_get_setting('b5_body_schema');
-  $variables['b5_body_bg_schema'] = theme_get_setting('b5_body_bg_schema');
+  $variables['b5_body_schema'] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_body_schema'), fn() => theme_get_setting('b5_body_schema'));
+  $variables['b5_body_bg_schema'] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_body_bg_schema'), fn() => theme_get_setting('b5_body_bg_schema'));
 
   // Add route as CSS class.
   $route_name = \Drupal::routeMatch()->getRouteName();
@@ -70,7 +62,7 @@ function bootstrap5_preprocess_html(&$variables) {
   $variables['attributes']['class'][] = 'page-route-' . $route_class;
 
   // Theme mode.
-  $variables['b5_theme_mode'] = theme_get_setting('b5_theme_mode');
+  $variables['b5_theme_mode'] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_theme_mode'), fn() => theme_get_setting('b5_theme_mode'));
 }
 
 /**
@@ -78,13 +70,13 @@ function bootstrap5_preprocess_html(&$variables) {
  */
 function bootstrap5_preprocess_page(&$variables) {
   // Pass variables to theme.
-  $variables['b5_top_container'] = theme_get_setting('b5_top_container');
+  $variables['b5_top_container'] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_top_container'), fn() => theme_get_setting('b5_top_container'));
   // Navbar colour theme.
-  $variables['b5_navbar_schema'] = theme_get_setting('b5_navbar_schema');
-  $variables['b5_navbar_bg_schema'] = theme_get_setting('b5_navbar_bg_schema');
+  $variables['b5_navbar_schema'] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_navbar_schema'), fn() => theme_get_setting('b5_navbar_schema'));
+  $variables['b5_navbar_bg_schema'] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_navbar_bg_schema'), fn() => theme_get_setting('b5_navbar_bg_schema'));
   // Footer colour theme.
-  $variables['b5_footer_schema'] = theme_get_setting('b5_footer_schema');
-  $variables['b5_footer_bg_schema'] = theme_get_setting('b5_footer_bg_schema');
+  $variables['b5_footer_schema'] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_footer_schema'), fn() => theme_get_setting('b5_footer_schema'));
+  $variables['b5_footer_bg_schema'] = DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_footer_bg_schema'), fn() => theme_get_setting('b5_footer_bg_schema'));
 
 }
 
@@ -95,47 +87,17 @@ function bootstrap5_preprocess_page(&$variables) {
  * because they will be processed by Twig and drupal_render will
  * be invoked.
  */
+#[LegacyHook]
 function bootstrap5_preprocess_menu_local_tasks(&$variables) {
-  if (!empty($variables['primary'])) {
-    $variables['primary']['#attached'] = [
-      'library' => [
-        'bootstrap5/drupal.nav-tabs',
-      ],
-    ];
-  }
-  elseif (!empty($variables['secondary'])) {
-    $variables['secondary']['#attached'] = [
-      'library' => [
-        'bootstrap5/drupal.nav-tabs',
-      ],
-    ];
-  }
-
-  foreach (Element::children($variables['primary']) as $key) {
-    $variables['primary'][$key]['#level'] = 'primary';
-  }
-  foreach (Element::children($variables['secondary']) as $key) {
-    $variables['secondary'][$key]['#level'] = 'secondary';
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->preprocessMenuLocalTasks($variables);
 }
 
 /**
  * Implements hook_preprocess_HOOK() for menu-local-task templates.
  */
+#[LegacyHook]
 function bootstrap5_preprocess_menu_local_task(&$variables) {
-  // Ensure is-active class is set when the tab is active. The generic active
-  // link handler applies stricter comparison rules than what is necessary for
-  // tabs.
-  if (isset($variables['is_active']) && $variables['is_active'] === TRUE) {
-    $variables['link']['#options']['attributes']['class'][] = 'nav-link active is-active';
-  }
-  else {
-    $variables['link']['#options']['attributes']['class'][] = 'nav-link';
-  }
-
-  if (isset($variables['element']['#level'])) {
-    $variables['level'] = $variables['element']['#level'];
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->preprocessMenuLocalTask($variables);
 }
 
 /**
@@ -155,18 +117,9 @@ function _bootstrap5_attributes_class_string_to_array(&$variables) {
 /**
  * Implements hook_preprocess_HOOK() for form element.
  */
+#[LegacyHook]
 function bootstrap5_preprocess_form_element(&$variables) {
-  if (isset($variables['type'])) {
-    if (in_array($variables['type'], ['checkbox', 'radio'])) {
-      if (isset($variables['label'])) {
-        $variables['label']['#attributes']['class'][] = 'form-check-label';
-      }
-      $variables['attributes']['class'][] = 'form-check';
-    }
-    elseif (in_array($variables['type'], ['file', 'managed_file'])) {
-      $variables['label']['#attributes']['class'][] = 'form-label';
-    }
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->preprocessFormElement($variables);
 }
 
 /**
@@ -210,8 +163,9 @@ function bootstrap5_preprocess_input(&$variables) {
 /**
  * Implements hook_preprocess_HOOK() for file input.
  */
+#[LegacyHook]
 function bootstrap5_preprocess_input__file(&$variables) {
-  $variables['attributes']['class'][] = 'form-control';
+  \Drupal::service(Bootstrap5Hooks::class)->preprocessInputFile($variables);
 }
 
 /**
@@ -225,17 +179,17 @@ function bootstrap5_preprocess_datetime_form(&$variables) {
 /**
  * Implements hook_preprocess_HOOK() for media library wrapper.
  */
+#[LegacyHook]
 function bootstrap5_preprocess_media_library_wrapper(&$variables) {
-  $variables['attributes']['class'][] = "d-flex";
+  \Drupal::service(Bootstrap5Hooks::class)->preprocessMediaLibraryWrapper($variables);
 }
 
 /**
  * Implements hook_preprocess_HOOK() for links in media library menu.
  */
+#[LegacyHook]
 function bootstrap5_preprocess_links__media_library_menu(&$variables) {
-  foreach ($variables['links'] as &$link) {
-    $link['link']['#options']['attributes']['class'][] = 'nav-link';
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->preprocessLinksMediaLibraryMenu($variables);
 }
 
 /**
@@ -316,54 +270,9 @@ function bootstrap5_preprocess_table(&$variables) {
 /**
  * Implements hook_views_pre_render().
  */
+#[LegacyHook]
 function bootstrap5_views_pre_render(ViewExecutable $view) {
-  $add_classes = function (&$option, array $classes_to_add) {
-    $classes = preg_split('/\s+/', $option);
-    $classes = array_filter($classes);
-    $classes = array_merge($classes, $classes_to_add);
-    $option = implode(' ', array_unique($classes));
-  };
-
-  if ($view->id() === 'media_library') {
-    if ($view->display_handler->options['defaults']['css_class']) {
-      $add_classes($view->displayHandlers->get('default')->options['css_class'], ['media-library-view']);
-    }
-    else {
-      $add_classes($view->display_handler->options['css_class'], ['media-library-view']);
-    }
-
-    if ($view->current_display === 'page') {
-      if (array_key_exists('media_bulk_form', $view->field)) {
-        $add_classes($view->field['media_bulk_form']->options['element_class'], ['media-library-item__click-to-select-checkbox']);
-      }
-      if (array_key_exists('rendered_entity', $view->field)) {
-        $add_classes($view->field['rendered_entity']->options['element_class'], ['media-library-item__content']);
-      }
-      if (array_key_exists('edit_media', $view->field)) {
-        $add_classes($view->field['edit_media']->options['alter']['link_class'], ['media-library-item__edit']);
-        $add_classes($view->field['edit_media']->options['alter']['link_class'], ['icon-link']);
-      }
-      if (array_key_exists('delete_media', $view->field)) {
-        $add_classes($view->field['delete_media']->options['alter']['link_class'], ['media-library-item__remove']);
-        $add_classes($view->field['delete_media']->options['alter']['link_class'], ['icon-link']);
-      }
-    }
-    elseif (strpos($view->current_display, 'widget') === 0) {
-      if (array_key_exists('rendered_entity', $view->field)) {
-        $add_classes($view->field['rendered_entity']->options['element_class'], ['media-library-item__content']);
-      }
-      if (array_key_exists('media_library_select_form', $view->field)) {
-        $add_classes($view->field['media_library_select_form']->options['element_wrapper_class'], ['media-library-item__click-to-select-checkbox']);
-      }
-
-      if ($view->display_handler->options['defaults']['css_class']) {
-        $add_classes($view->displayHandlers->get('default')->options['css_class'], ['media-library-view--widget']);
-      }
-      else {
-        $add_classes($view->display_handler->options['css_class'], ['media-library-view--widget']);
-      }
-    }
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->viewsPreRender($view);
 }
 
 /**
@@ -371,9 +280,9 @@ function bootstrap5_views_pre_render(ViewExecutable $view) {
  *
  * This targets each media item selected in an entity reference field.
  */
+#[LegacyHook]
 function bootstrap5_preprocess_media_library_item__widget(array &$variables) {
-  $variables['content']['remove_button']['#attributes']['class'][] = 'media-library-item__remove';
-  $variables['content']['remove_button']['#attributes']['class'][] = 'icon-link';
+  \Drupal::service(Bootstrap5Hooks::class)->preprocessMediaLibraryItemWidget($variables);
 }
 
 /**
@@ -382,41 +291,23 @@ function bootstrap5_preprocess_media_library_item__widget(array &$variables) {
  * Pass block region value to content so this can be used in
  * THEME_theme_suggestions_menu_alter.
  */
+#[LegacyHook]
 function bootstrap5_preprocess_block(&$variables) {
-  if (isset($variables['elements']['#id']) && !isset($variables['content']['#lazy_builder'])) {
-    $block = Block::load($variables['elements']['#id']);
-    if ($block) {
-      $region = Block::load($variables['elements']['#id'])->getRegion();
-      if (!empty($region)) {
-        $variables['content']['#attributes']['data-block']['region'] = $region;
-      }
-    }
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->preprocessBlock($variables);
 }
 
 /**
  * Implements hook_theme_suggestions_HOOK_alter().
  */
+#[LegacyHook]
 function bootstrap5_theme_suggestions_menu_alter(array &$suggestions, array $variables) {
-  if (isset($variables['attributes']['data-block']['region'])) {
-    $region = $variables['attributes']['data-block']['region'];
-    $suggestions[] = $variables['theme_hook_original'] . '__' . $region;
-    $suggestions[] = 'menu__' . $region;
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->themeSuggestionsMenuAlter($suggestions, $variables);
 }
 
 /**
  * Implements hook_form_alter().
  */
+#[LegacyHook]
 function bootstrap5_form_alter(&$form, FormStateInterface $form_state, $form_id) {
-  // Copied from claro.theme claro_form_alter().
-  $form_object = $form_state->getFormObject();
-  if ($form_object instanceof ViewsForm && strpos($form_object->getBaseFormId(), 'views_form_media_library') === 0) {
-    if (isset($form['header'])) {
-      $form['header']['#attributes']['class'][] = 'media-library-views-form__header';
-      $form['header']['media_bulk_form']['#attributes']['class'][] = 'media-library-views-form__bulk_form';
-    }
-    $form['actions']['submit']['#attributes']['class'] = ['media-library-select'];
-    $form['#attributes']['class'][] = 'media-library-views-form';
-  }
+  \Drupal::service(Bootstrap5Hooks::class)->formAlter($form, $form_state, $form_id);
 }
diff --git a/src/Hook/Bootstrap5Hooks.php b/src/Hook/Bootstrap5Hooks.php
new file mode 100644
index 0000000..cf9db82
--- /dev/null
+++ b/src/Hook/Bootstrap5Hooks.php
@@ -0,0 +1,278 @@
+<?php
+
+namespace Drupal\bootstrap5\Hook;
+
+use Drupal\views\Form\ViewsForm;
+use Drupal\block\Entity\Block;
+use Drupal\views\ViewExecutable;
+use Drupal\Core\Render\Element;
+use Drupal\bootstrap5\SettingsManager;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+
+/**
+ * Hook implementations for bootstrap5.
+ */
+class Bootstrap5Hooks {
+
+  /**
+   * Implements hook_theme_suggestions_HOOK_alter().
+   */
+  #[Hook('theme_suggestions_page_alter')]
+  public static function themeSuggestionsPageAlter(array &$suggestions, array $variables) {
+    if (isset($_GET['styleguide'])) {
+      $suggestions[] = 'page__styleguide';
+    }
+    if (isset($variables['attributes']['data-block']['region'])) {
+      $region = $variables['attributes']['data-block']['region'];
+      $suggestions[] = $variables['theme_hook_original'] . '__' . $region;
+      $suggestions[] = 'menu__' . $region;
+    }
+  }
+
+  /**
+   * Implements hook_form_FORM_ID_alter().
+   */
+  #[Hook('form_system_theme_settings_alter')]
+  public static function formSystemThemeSettingsAlter(&$form, FormStateInterface $form_state, $form_id = NULL) {
+    $settings_manager = new SettingsManager(\Drupal::service('theme.manager'));
+    return $settings_manager->themeSettingsAlter($form, $form_state, $form_id);
+  }
+
+  /**
+   * Implements hook_preprocess_HOOK() for menu-local-tasks templates.
+   *
+   * Use preprocess hook to set #attached to child elements
+   * because they will be processed by Twig and drupal_render will
+   * be invoked.
+   */
+  #[Hook('preprocess_menu_local_tasks')]
+  public static function preprocessMenuLocalTasks(&$variables) {
+    if (!empty($variables['primary'])) {
+      $variables['primary']['#attached'] = [
+        'library' => [
+          'bootstrap5/drupal.nav-tabs',
+        ],
+      ];
+    }
+    elseif (!empty($variables['secondary'])) {
+      $variables['secondary']['#attached'] = [
+        'library' => [
+          'bootstrap5/drupal.nav-tabs',
+        ],
+      ];
+    }
+    foreach (Element::children($variables['primary']) as $key) {
+      $variables['primary'][$key]['#level'] = 'primary';
+    }
+    foreach (Element::children($variables['secondary']) as $key) {
+      $variables['secondary'][$key]['#level'] = 'secondary';
+    }
+  }
+
+  /**
+   * Implements hook_preprocess_HOOK() for menu-local-task templates.
+   */
+  #[Hook('preprocess_menu_local_task')]
+  public static function preprocessMenuLocalTask(&$variables) {
+    // Ensure is-active class is set when the tab is active. The generic active
+    // link handler applies stricter comparison rules than what is necessary for
+    // tabs.
+    if (isset($variables['is_active']) && $variables['is_active'] === TRUE) {
+      $variables['link']['#options']['attributes']['class'][] = 'nav-link active is-active';
+    }
+    else {
+      $variables['link']['#options']['attributes']['class'][] = 'nav-link';
+    }
+    if (isset($variables['element']['#level'])) {
+      $variables['level'] = $variables['element']['#level'];
+    }
+  }
+
+  /**
+   * Implements hook_preprocess_HOOK() for form element.
+   */
+  #[Hook('preprocess_form_element')]
+  public static function preprocessFormElement(&$variables) {
+    if (isset($variables['type'])) {
+      if (in_array($variables['type'], [
+        'checkbox',
+        'radio',
+      ])) {
+        if (isset($variables['label'])) {
+          $variables['label']['#attributes']['class'][] = 'form-check-label';
+        }
+        $variables['attributes']['class'][] = 'form-check';
+      }
+      elseif (in_array($variables['type'], [
+        'file',
+        'managed_file',
+      ])) {
+        $variables['label']['#attributes']['class'][] = 'form-label';
+      }
+    }
+  }
+
+  /**
+   * Implements hook_preprocess_HOOK() for file input.
+   */
+  #[Hook('preprocess_input__file')]
+  public static function preprocessInputFile(&$variables) {
+    $variables['attributes']['class'][] = 'form-control';
+  }
+
+  /**
+   * Implements hook_preprocess_HOOK() for media library wrapper.
+   */
+  #[Hook('preprocess_media_library_wrapper')]
+  public static function preprocessMediaLibraryWrapper(&$variables) {
+    $variables['attributes']['class'][] = "d-flex";
+  }
+
+  /**
+   * Implements hook_preprocess_HOOK() for links in media library menu.
+   */
+  #[Hook('preprocess_links__media_library_menu')]
+  public static function preprocessLinksMediaLibraryMenu(&$variables) {
+    foreach ($variables['links'] as &$link) {
+      $link['link']['#options']['attributes']['class'][] = 'nav-link';
+    }
+  }
+
+  /**
+   * Implements hook_views_pre_render().
+   */
+  #[Hook('views_pre_render')]
+  public static function viewsPreRender(ViewExecutable $view) {
+    $add_classes = function (&$option, array $classes_to_add) {
+      $classes = preg_split('/\s+/', $option);
+      $classes = array_filter($classes);
+      $classes = array_merge($classes, $classes_to_add);
+      $option = implode(' ', array_unique($classes));
+    };
+    if ($view->id() === 'media_library') {
+      if ($view->display_handler->options['defaults']['css_class']) {
+        $add_classes($view->displayHandlers->get('default')->options['css_class'], [
+          'media-library-view',
+        ]);
+      }
+      else {
+        $add_classes($view->display_handler->options['css_class'], [
+          'media-library-view',
+        ]);
+      }
+      if ($view->current_display === 'page') {
+        if (array_key_exists('media_bulk_form', $view->field)) {
+          $add_classes($view->field['media_bulk_form']->options['element_class'], [
+            'media-library-item__click-to-select-checkbox',
+          ]);
+        }
+        if (array_key_exists('rendered_entity', $view->field)) {
+          $add_classes($view->field['rendered_entity']->options['element_class'], [
+            'media-library-item__content',
+          ]);
+        }
+        if (array_key_exists('edit_media', $view->field)) {
+          $add_classes($view->field['edit_media']->options['alter']['link_class'], [
+            'media-library-item__edit',
+          ]);
+          $add_classes($view->field['edit_media']->options['alter']['link_class'], [
+            'icon-link',
+          ]);
+        }
+        if (array_key_exists('delete_media', $view->field)) {
+          $add_classes($view->field['delete_media']->options['alter']['link_class'], [
+            'media-library-item__remove',
+          ]);
+          $add_classes($view->field['delete_media']->options['alter']['link_class'], [
+            'icon-link',
+          ]);
+        }
+      }
+      elseif (strpos($view->current_display, 'widget') === 0) {
+        if (array_key_exists('rendered_entity', $view->field)) {
+          $add_classes($view->field['rendered_entity']->options['element_class'], [
+            'media-library-item__content',
+          ]);
+        }
+        if (array_key_exists('media_library_select_form', $view->field)) {
+          $add_classes($view->field['media_library_select_form']->options['element_wrapper_class'], [
+            'media-library-item__click-to-select-checkbox',
+          ]);
+        }
+        if ($view->display_handler->options['defaults']['css_class']) {
+          $add_classes($view->displayHandlers->get('default')->options['css_class'], [
+            'media-library-view--widget',
+          ]);
+        }
+        else {
+          $add_classes($view->display_handler->options['css_class'], [
+            'media-library-view--widget',
+          ]);
+        }
+      }
+    }
+  }
+
+  /**
+   * Implements hook_preprocess_media_library_item__widget().
+   *
+   * This targets each media item selected in an entity reference field.
+   */
+  #[Hook('preprocess_media_library_item__widget')]
+  public static function preprocessMediaLibraryItemWidget(array &$variables) {
+    $variables['content']['remove_button']['#attributes']['class'][] = 'media-library-item__remove';
+    $variables['content']['remove_button']['#attributes']['class'][] = 'icon-link';
+  }
+
+  /**
+   * Implements hook_preprocess_HOOK().
+   *
+   * Pass block region value to content so this can be used in
+   * THEME_theme_suggestions_menu_alter.
+   */
+  #[Hook('preprocess_block')]
+  public static function preprocessBlock(&$variables) {
+    if (isset($variables['elements']['#id']) && !isset($variables['content']['#lazy_builder'])) {
+      $block = Block::load($variables['elements']['#id']);
+      if ($block) {
+        $region = Block::load($variables['elements']['#id'])->getRegion();
+        if (!empty($region)) {
+          $variables['content']['#attributes']['data-block']['region'] = $region;
+        }
+      }
+    }
+  }
+
+  /**
+   * Implements hook_theme_suggestions_HOOK_alter().
+   */
+  #[Hook('theme_suggestions_menu_alter')]
+  public static function themeSuggestionsMenuAlter(array &$suggestions, array $variables) {
+    if (isset($variables['attributes']['data-block']['region'])) {
+      $region = $variables['attributes']['data-block']['region'];
+      $suggestions[] = $variables['theme_hook_original'] . '__' . $region;
+      $suggestions[] = 'menu__' . $region;
+    }
+  }
+
+  /**
+   * Implements hook_form_alter().
+   */
+  #[Hook('form_alter')]
+  public static function formAlter(&$form, FormStateInterface $form_state, $form_id) {
+    // Copied from claro.theme claro_form_alter().
+    $form_object = $form_state->getFormObject();
+    if ($form_object instanceof ViewsForm && strpos($form_object->getBaseFormId(), 'views_form_media_library') === 0) {
+      if (isset($form['header'])) {
+        $form['header']['#attributes']['class'][] = 'media-library-views-form__header';
+        $form['header']['media_bulk_form']['#attributes']['class'][] = 'media-library-views-form__bulk_form';
+      }
+      $form['actions']['submit']['#attributes']['class'] = [
+        'media-library-select',
+      ];
+      $form['#attributes']['class'][] = 'media-library-views-form';
+    }
+  }
+
+}
diff --git a/src/SettingsManager.php b/src/SettingsManager.php
index b0e4839..d23d2e1 100644
--- a/src/SettingsManager.php
+++ b/src/SettingsManager.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\bootstrap5;
 
+use Drupal\Component\Utility\DeprecationHelper;
+use Drupal\Core\Extension\ThemeSettingsProvider;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\Theme\ThemeManagerInterface;
@@ -92,7 +94,7 @@ class SettingsManager {
     ];
 
     // Populating extra options for top container.
-    foreach (explode("\n", theme_get_setting('b5_top_container_config') ?? '') as $line) {
+    foreach (explode("\n", DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_top_container_config'), fn() => theme_get_setting('b5_top_container_config')) ?? '') as $line) {
       $values = explode("|", trim($line) ?? '');
       if (is_array($values) && (count($values) == 2)) {
         $options_top_container += [trim($values[0]) => trim($values[1])];
@@ -109,7 +111,7 @@ class SettingsManager {
     $form['theme_mode_details']['b5_theme_mode'] = [
       '#type' => 'select',
       '#title' => $this->t('Theme mode'),
-      '#default_value' => theme_get_setting('b5_theme_mode'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_theme_mode'), fn() => theme_get_setting('b5_theme_mode')),
       '#description' => $this->t('Select the color theme mode: light or dark.'),
       '#options' => [
         'light' => $this->t('Light'),
@@ -127,7 +129,7 @@ class SettingsManager {
     $form['body_details']['b5_top_container'] = [
       '#type' => 'select',
       '#title' => $this->t('Website container type'),
-      '#default_value' => theme_get_setting('b5_top_container'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_top_container'), fn() => theme_get_setting('b5_top_container')),
       '#description' => $this->t("Type of top level container: fluid (eg edge to edge) or fixed width"),
       '#options' => $options_top_container,
     ];
@@ -135,14 +137,14 @@ class SettingsManager {
     $form['body_details']['b5_top_container_config'] = [
       '#type' => 'textarea',
       '#title' => $this->t('Website container type configuration'),
-      '#default_value' => theme_get_setting('b5_top_container_config'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_top_container_config'), fn() => theme_get_setting('b5_top_container_config')),
       '#description' => $this->t("Format: <classes|label> on each line, e.g. <br><pre>container|fixed<br />container-fluid m-0 p-0|fluid</pre>"),
     ];
 
     $form['body_details']['b5_body_schema'] = [
       '#type' => 'select',
       '#title' => $this->t('Body theme:'),
-      '#default_value' => theme_get_setting('b5_body_schema'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_body_schema'), fn() => theme_get_setting('b5_body_schema')),
       '#description' => $this->t("Text colour theme of the body."),
       '#options' => $options_theme,
     ];
@@ -150,7 +152,7 @@ class SettingsManager {
     $form['body_details']['b5_body_bg_schema'] = [
       '#type' => 'select',
       '#title' => $this->t('Body background:'),
-      '#default_value' => theme_get_setting('b5_body_bg_schema'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_body_bg_schema'), fn() => theme_get_setting('b5_body_bg_schema')),
       '#description' => $this->t("Background color of the body."),
       '#options' => $options_colour,
     ];
@@ -165,7 +167,7 @@ class SettingsManager {
     $form['nav_details']['b5_navbar_schema'] = [
       '#type' => 'select',
       '#title' => $this->t('Navbar theme:'),
-      '#default_value' => theme_get_setting('b5_navbar_schema'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_navbar_schema'), fn() => theme_get_setting('b5_navbar_schema')),
       '#description' => $this->t("Text colour theme of the navbar."),
       '#options' => $options_theme,
     ];
@@ -173,7 +175,7 @@ class SettingsManager {
     $form['nav_details']['b5_navbar_bg_schema'] = [
       '#type' => 'select',
       '#title' => $this->t('Navbar background:'),
-      '#default_value' => theme_get_setting('b5_navbar_bg_schema'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_navbar_bg_schema'), fn() => theme_get_setting('b5_navbar_bg_schema')),
       '#description' => $this->t("Background color of the navbar."),
       '#options' => $options_colour,
     ];
@@ -188,7 +190,7 @@ class SettingsManager {
     $form['footer_details']['b5_footer_schema'] = [
       '#type' => 'select',
       '#title' => $this->t('Footer theme:'),
-      '#default_value' => theme_get_setting('b5_footer_schema'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_footer_schema'), fn() => theme_get_setting('b5_footer_schema')),
       '#description' => $this->t("Text colour theme of the footer."),
       '#options' => $options_theme,
     ];
@@ -196,7 +198,7 @@ class SettingsManager {
     $form['footer_details']['b5_footer_bg_schema'] = [
       '#type' => 'select',
       '#title' => $this->t('Footer background:'),
-      '#default_value' => theme_get_setting('b5_footer_bg_schema'),
+      '#default_value' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.3.0', fn() => \Drupal::service(ThemeSettingsProvider::class)->getSetting('b5_footer_bg_schema'), fn() => theme_get_setting('b5_footer_bg_schema')),
       '#description' => $this->t("Background color of the footer."),
       '#options' => $options_colour,
     ];
