diff --git a/session_entity.module b/session_entity.module
index 87878ac..aae7867 100644
--- a/session_entity.module
+++ b/session_entity.module
@@ -5,17 +5,14 @@
  * Contains session_entity.module.
  */
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\session_entity\Hook\SessionEntityHooks;
 use Drupal\Core\Routing\RouteMatchInterface;
 
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function session_entity_help($route_name, RouteMatchInterface $route_match) {
-  switch ($route_name) {
-    case 'help.page.session_entity':
-      $output = '';
-      $output .= '<h3>' . t('About') . '</h3>';
-      $output .= '<p>' . t("Session Entity provides entities which are stored in the user's session. Each user has one entity, which they may edit.") . '</p>';
-      return $output;
-  }
+  return \Drupal::service(SessionEntityHooks::class)->help($route_name, $route_match);
 }
diff --git a/session_entity.services.yml b/session_entity.services.yml
index 2e1d12d..6e582fc 100644
--- a/session_entity.services.yml
+++ b/session_entity.services.yml
@@ -2,3 +2,7 @@ services:
   session_entity.current:
     class: Drupal\session_entity\SessionEntityCurrentSessionEntity
     arguments: ['@entity_type.manager']
+
+  Drupal\session_entity\Hook\SessionEntityHooks:
+    class: Drupal\session_entity\Hook\SessionEntityHooks
+    autowire: true
diff --git a/src/Hook/SessionEntityHooks.php b/src/Hook/SessionEntityHooks.php
new file mode 100644
index 0000000..6c7219b
--- /dev/null
+++ b/src/Hook/SessionEntityHooks.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Drupal\session_entity\Hook;
+
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+
+/**
+ * Hook implementations for session_entity.
+ */
+class SessionEntityHooks {
+  use StringTranslationTrait;
+
+  /**
+   * Implements hook_help().
+   */
+  #[Hook('help')]
+  public function help($route_name, RouteMatchInterface $route_match) {
+    switch ($route_name) {
+      case 'help.page.session_entity':
+        $output = '';
+        $output .= '<h3>' . $this->t('About') . '</h3>';
+        $output .= '<p>' . $this->t("Session Entity provides entities which are stored in the user's session. Each user has one entity, which they may edit.") . '</p>';
+        return $output;
+    }
+  }
+
+}
diff --git a/src/SessionEntitySessionStorage.php b/src/SessionEntitySessionStorage.php
index 387bea2..fe09843 100644
--- a/src/SessionEntitySessionStorage.php
+++ b/src/SessionEntitySessionStorage.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\session_entity;
 
+use Drupal\Component\Utility\DeprecationHelper;
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
 use Drupal\Core\Entity\ContentEntityNullStorage;
@@ -50,13 +51,15 @@ class SessionEntitySessionStorage extends ContentEntityNullStorage {
    * @param \Drupal\Core\Session\AccountInterface $current_user
    *   Defines an account interface which represents the current user.
    */
-  public function __construct(EntityTypeInterface $entity_type,
-      EntityFieldManagerInterface $entity_field_manager,
-      CacheBackendInterface $cache,
-      MemoryCacheInterface $memory_cache,
-      EntityTypeBundleInfoInterface $entity_type_bundle_info,
-      PrivateTempStoreFactory $temp_store_factory,
-      AccountInterface $current_user) {
+  public function __construct(
+    EntityTypeInterface $entity_type,
+    EntityFieldManagerInterface $entity_field_manager,
+    CacheBackendInterface $cache,
+    MemoryCacheInterface $memory_cache,
+    EntityTypeBundleInfoInterface $entity_type_bundle_info,
+    PrivateTempStoreFactory $temp_store_factory,
+    AccountInterface $current_user,
+  ) {
     parent::__construct($entity_type, $entity_field_manager, $cache, $memory_cache, $entity_type_bundle_info);
 
     $this->tempStoreFactory = $temp_store_factory;
@@ -95,7 +98,7 @@ class SessionEntitySessionStorage extends ContentEntityNullStorage {
       // Force a session to be started for anonymous users. Workaround for a
       // core bug.
       // @todo Remove this when https://www.drupal.org/node/2743931 is fixed.
-      $_SESSION['session_entity_forced'] = '';
+      DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.2.0', fn() => \Drupal::request()->getSession()->set('session_entity_forced', ''), fn() => $_SESSION['session_entity_forced'] = '');
     }
 
     // Save the entity to the user's private tempstore.
