diff --git a/entity_theme_engine.module b/entity_theme_engine.module
index 2a2e34d..2e2c743 100644
--- a/entity_theme_engine.module
+++ b/entity_theme_engine.module
@@ -1,5 +1,7 @@
 <?php
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\entity_theme_engine\Hook\EntityThemeEngineHooks;
 use Drupal\Core\Url;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
@@ -14,26 +16,17 @@ use Drupal\Core\Routing\RouteMatchInterface;
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function entity_theme_engine_help($route_name, RouteMatchInterface $route_match) {
-  switch ($route_name) {
-    case 'help.page.entity_theme_engine':
-      $output = '';
-      $output .= '<h2>' . t('About') . '</h2>';
-      $output .= '<p>' . t('The Entity theme engine module can change entity template with twig.') . '</p>';
-      $output .= '<h2>' . t('Uses') . '</h2>';
-      $output .= '<dl>';
-      $output .= '<dt>' . t('Using Entity theme engine module') . '</dt>';
-      $output .= '<dd>' . t('<a href=":actions">online documentation for the Entity theme engine module</a>.', [':actions' => Url::fromRoute('entity.entity_widget.collection')->toString()]) . '</dd>';
-      $output .= '</dl>';
-      return $output;
-  }
+  return \Drupal::service(EntityThemeEngineHooks::class)->help($route_name, $route_match);
 }
 
 /**
  * Implements hook_entity_view_alter().
  */
+#[LegacyHook]
 function entity_theme_engine_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
-  \Drupal::service('entity_theme_engine.entity_widget_service')->entityViewAlter($build, $entity, $display->getMode());
+  \Drupal::service(EntityThemeEngineHooks::class)->entityViewAlter($build, $entity, $display);
 }
 
 /**
diff --git a/entity_theme_engine.services.yml b/entity_theme_engine.services.yml
index 90b124a..85a03f5 100644
--- a/entity_theme_engine.services.yml
+++ b/entity_theme_engine.services.yml
@@ -57,3 +57,7 @@ services:
 #    arguments: ['@entity_type.manager']
 #    tags:
 #      - { name: normalizer, priority: 110 }
+
+  Drupal\entity_theme_engine\Hook\EntityThemeEngineHooks:
+    class: Drupal\entity_theme_engine\Hook\EntityThemeEngineHooks
+    autowire: true
diff --git a/src/EntityWidgetService.php b/src/EntityWidgetService.php
index c7c12d6..6aa8161 100644
--- a/src/EntityWidgetService.php
+++ b/src/EntityWidgetService.php
@@ -3,6 +3,7 @@
 namespace Drupal\entity_theme_engine;
 
 
+use Twig\Error\RuntimeError;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\entity_theme_engine\Entity\EntityWidget;
 use Drupal\Core\Entity\FieldableEntityInterface;
@@ -63,7 +64,7 @@ class EntityWidgetService {
   public function renderEntity(array $build, EntityWidget $widget, EntityInterface $entity, $display) {
     try {
       $variables = $this->getRenderVariables($build, $widget, $entity);
-    } catch(\Twig\Error\RuntimeError $e) {
+    } catch(RuntimeError $e) {
       $this->logger->error("Twig\Error\RuntimeError: renderEntity, key: {$entity->id()}:{$entity->getEntityTypeId()}:{$entity->bundle()}:{$display}");
       throw $e;
     }
diff --git a/src/Hook/EntityThemeEngineHooks.php b/src/Hook/EntityThemeEngineHooks.php
new file mode 100644
index 0000000..5af717f
--- /dev/null
+++ b/src/Hook/EntityThemeEngineHooks.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace Drupal\entity_theme_engine\Hook;
+
+use Drupal\Core\Url;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+/**
+ * Hook implementations for entity_theme_engine.
+ */
+class EntityThemeEngineHooks
+{
+    use StringTranslationTrait;
+    /**
+     * @file
+     * Contains entity_theme_engine.module.
+     */
+    /**
+     * Implements hook_help().
+     */
+    #[Hook('help')]
+    public function help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match)
+    {
+        switch ($route_name) {
+            case 'help.page.entity_theme_engine':
+                $output = '';
+                $output .= '<h2>' . $this->t('About') . '</h2>';
+                $output .= '<p>' . $this->t('The Entity theme engine module can change entity template with twig.') . '</p>';
+                $output .= '<h2>' . $this->t('Uses') . '</h2>';
+                $output .= '<dl>';
+                $output .= '<dt>' . $this->t('Using Entity theme engine module') . '</dt>';
+                $output .= '<dd>' . $this->t('<a href=":actions">online documentation for the Entity theme engine module</a>.', [
+                    ':actions' => \Drupal\Core\Url::fromRoute('entity.entity_widget.collection')->toString(),
+                ]) . '</dd>';
+                $output .= '</dl>';
+                return $output;
+        }
+    }
+    /**
+     * Implements hook_entity_view_alter().
+     */
+    #[Hook('entity_view_alter')]
+    public static function entityViewAlter(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display)
+    {
+        \Drupal::service('entity_theme_engine.entity_widget_service')->entityViewAlter($build, $entity, $display->getMode());
+    }
+}
diff --git a/src/Normalizer/ContentEntityNormalizer.php b/src/Normalizer/ContentEntityNormalizer.php
index 65bca08..1e8ca24 100644
--- a/src/Normalizer/ContentEntityNormalizer.php
+++ b/src/Normalizer/ContentEntityNormalizer.php
@@ -40,7 +40,7 @@ class ContentEntityNormalizer extends NormalizerBase {
   /**
    * {@inheritdoc}
    */
-  public function normalize($entity, $format = NULL, array $context = []) {
+  public function normalize($entity, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $label = '';
     try {
       $label = $entity->label();
diff --git a/src/Normalizer/DateItemNormalizer.php b/src/Normalizer/DateItemNormalizer.php
index fc387db..388499f 100644
--- a/src/Normalizer/DateItemNormalizer.php
+++ b/src/Normalizer/DateItemNormalizer.php
@@ -17,7 +17,7 @@ class DateItemNormalizer extends FieldItemNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($field, $format = NULL, array $context = []) {
+  public function normalize($field, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $data = parent::normalize($field, $format, $context);
     if($date = $field->date) {
       $timezone = DateTimeItemInterface::STORAGE_TIMEZONE;
diff --git a/src/Normalizer/EntityReferenceItemNormalizer.php b/src/Normalizer/EntityReferenceItemNormalizer.php
index c009c0b..a4321df 100644
--- a/src/Normalizer/EntityReferenceItemNormalizer.php
+++ b/src/Normalizer/EntityReferenceItemNormalizer.php
@@ -41,7 +41,7 @@ class EntityReferenceItemNormalizer extends FieldItemNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($field, $format = NULL, array $context = []) {
+  public function normalize($field, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $data = parent::normalize($field, $format, $context);
     if(empty($field->entity)) {
       return $data;
diff --git a/src/Normalizer/FieldItemNormalizer.php b/src/Normalizer/FieldItemNormalizer.php
index b11dff5..3341edc 100644
--- a/src/Normalizer/FieldItemNormalizer.php
+++ b/src/Normalizer/FieldItemNormalizer.php
@@ -17,7 +17,7 @@ class FieldItemNormalizer extends ContentEntityNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($object, $format = NULL, array $context = []) {
+  public function normalize($object, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $cache = [
       'contexts' => [],
       'tags' => [],
diff --git a/src/Normalizer/FileItemNormalizer.php b/src/Normalizer/FileItemNormalizer.php
index 44673b5..7074964 100644
--- a/src/Normalizer/FileItemNormalizer.php
+++ b/src/Normalizer/FileItemNormalizer.php
@@ -15,7 +15,7 @@ class FileItemNormalizer extends FieldItemNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($field, $format = NULL, array $context = []) {
+  public function normalize($field, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $data = parent::normalize($field, $format, $context);
     if ($field->entity) {
       $uri = $field->entity->getFileUri();
diff --git a/src/Normalizer/ImageItemNormalizer.php b/src/Normalizer/ImageItemNormalizer.php
index 9656049..26b6d6f 100644
--- a/src/Normalizer/ImageItemNormalizer.php
+++ b/src/Normalizer/ImageItemNormalizer.php
@@ -15,7 +15,7 @@ class ImageItemNormalizer extends FileItemNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($field, $format = NULL, array $context = []) {
+  public function normalize($field, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $data = parent::normalize($field, $format, $context);
     $data['styles'] = $this->getImageStylesVariables($field->entity);
     return $data;
diff --git a/src/Normalizer/LinkItemNormalizer.php b/src/Normalizer/LinkItemNormalizer.php
index 077cf92..dc2b5ce 100644
--- a/src/Normalizer/LinkItemNormalizer.php
+++ b/src/Normalizer/LinkItemNormalizer.php
@@ -15,7 +15,7 @@ class LinkItemNormalizer extends FieldItemNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($object, $format = NULL, array $context = []) {
+  public function normalize($object, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $data = parent::normalize($object, $format, $context);
     $data['title'] = $object->title;
     $data['url'] = $object->getUrl()->toString(TRUE)->getGeneratedUrl();
diff --git a/src/Normalizer/ListItemNormalizer.php b/src/Normalizer/ListItemNormalizer.php
index 813f0f3..0f2140d 100644
--- a/src/Normalizer/ListItemNormalizer.php
+++ b/src/Normalizer/ListItemNormalizer.php
@@ -15,7 +15,7 @@ class ListItemNormalizer extends FieldItemNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($field, $format = NULL, array $context = []) {
+  public function normalize($field, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $data = parent::normalize($field, $format, $context);
     $data['options'] = $field->getPossibleOptions();
     return $data;
diff --git a/src/Normalizer/TextItemNormalizer.php b/src/Normalizer/TextItemNormalizer.php
index d2c5428..df7cf58 100644
--- a/src/Normalizer/TextItemNormalizer.php
+++ b/src/Normalizer/TextItemNormalizer.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\entity_theme_engine\Normalizer;
 
+use Drupal\filter\Entity\FilterFormat;
 use Drupal\filter\Plugin\FilterInterface;
 
 class TextItemNormalizer extends FieldItemNormalizer {
@@ -16,7 +17,7 @@ class TextItemNormalizer extends FieldItemNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($field, $format = NULL, array $context = []) {
+  public function normalize($field, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $data = parent::normalize($field, $format, $context);
     $data['render'] = [
       '#type' => 'processed_text',
@@ -27,7 +28,7 @@ class TextItemNormalizer extends FieldItemNormalizer {
     if(isset($context['#no_render']) && $context['#no_render']) {
       if (isset($data['format'])) {
         /** @var \Drupal\filter\Entity\FilterFormat $format **/
-        $format = \Drupal\filter\Entity\FilterFormat::load($data['format']);
+        $format = FilterFormat::load($data['format']);
         if ($format) {
           $text = $data['value'];
           $filters = $format->filters();
diff --git a/src/Normalizer/ViewsItemNormalizer.php b/src/Normalizer/ViewsItemNormalizer.php
index bdb4926..d2ae13e 100644
--- a/src/Normalizer/ViewsItemNormalizer.php
+++ b/src/Normalizer/ViewsItemNormalizer.php
@@ -18,7 +18,7 @@ class ViewsItemNormalizer extends FieldItemNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($field, $format = NULL, array $context = []) {
+  public function normalize($field, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
     $data = parent::normalize($field, $format, $context);
 
     $view_name = $field->target_id;
