diff --git a/conditional_rendering.module b/conditional_rendering.module
index 048a4c2..d0b0a8d 100644
--- a/conditional_rendering.module
+++ b/conditional_rendering.module
@@ -5,60 +5,30 @@
  * Primary module hooks for Conditional Content Block Rendering module.
  */
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\conditional_rendering\Hook\ConditionalRenderingHooks;
 use Drupal\Core\Entity\EntityTypeInterface;
-use Drupal\Core\Field\BaseFieldDefinition;
-use Drupal\Core\Field\FieldStorageDefinitionInterface;
 
 /**
  * Implements hook_entity_base_field_info().
  */
+#[LegacyHook]
 function conditional_rendering_entity_base_field_info(EntityTypeInterface $entity_type) {
-  if ($entity_type->id() === 'block_content') {
-    $fields = [];
-
-    $fields['conditional_rendering_action'] = BaseFieldDefinition::create('list_string')
-      ->setLabel(t('Conditional Rendering Action'))
-      ->setDescription(t('The action to be taken if the conditions are met.'))
-      ->setSetting('allowed_values', [
-        'show' => t('Show'),
-        'hide' => t('Hide'),
-      ])
-      ->setDisplayOptions('form', [
-        'type' => 'options_select',
-        'weight' => 0,
-      ])
-      ->setDisplayConfigurable('form', TRUE);
-
-    $fields['conditional_rendering_conditions'] = BaseFieldDefinition::create('conditional_rendering_condition')
-      ->setLabel(t('Conditions'))
-      ->setDescription(t('The conditions to be met for this block to be rendered.'))
-      ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
-      ->setDisplayOptions('form', [
-        'type' => 'conditional_rendering_condition',
-        'weight' => 0,
-      ])
-      ->setDisplayConfigurable('form', TRUE);
-    return $fields;
-  }
+  return \Drupal::service(ConditionalRenderingHooks::class)->entityBaseFieldInfo($entity_type);
 }
 
 /**
  * Implements hook_page_attachments().
  */
+#[LegacyHook]
 function conditional_rendering_page_attachments(array &$page) {
-  $page['#attached']['library'][] = 'conditional_rendering/conditional_rendering';
+  \Drupal::service(ConditionalRenderingHooks::class)->pageAttachments($page);
 }
 
 /**
  * Implements hook_preprocess_block().
  */
+#[LegacyHook]
 function conditional_rendering_preprocess_block(&$variables) {
-  // Adding a css class to identify a block with a conditional rendering set.
-  if (isset($variables['content']['#block_content'])) {
-    /** @var \Drupal\block_content\Entity\BlockContent $block **/
-    $block = $variables['content']['#block_content'];
-    if ($block->hasField('conditional_rendering_action') && $block->get('conditional_rendering_action')->value) {
-      $variables['attributes']['class'][] = 'conditional-rendering-block';
-    }
-  }
+  \Drupal::service(ConditionalRenderingHooks::class)->preprocessBlock($variables);
 }
diff --git a/conditional_rendering.services.yml b/conditional_rendering.services.yml
index 3067de0..64efdc2 100644
--- a/conditional_rendering.services.yml
+++ b/conditional_rendering.services.yml
@@ -12,3 +12,7 @@ services:
       - '@entity_type.manager'
     tags:
       - { name: event_subscriber }
+
+  Drupal\conditional_rendering\Hook\ConditionalRenderingHooks:
+    class: Drupal\conditional_rendering\Hook\ConditionalRenderingHooks
+    autowire: true
diff --git a/src/EventSubscriber/RenderBlockSubscriber.php b/src/EventSubscriber/RenderBlockSubscriber.php
index 5f303d1..2ff7d2e 100644
--- a/src/EventSubscriber/RenderBlockSubscriber.php
+++ b/src/EventSubscriber/RenderBlockSubscriber.php
@@ -61,7 +61,7 @@ class RenderBlockSubscriber implements EventSubscriberInterface {
   /**
    * {@inheritdoc}
    */
-  public static function getSubscribedEvents() {
+  public static function getSubscribedEvents(): array {
     $events[LayoutBuilderEvents::SECTION_COMPONENT_BUILD_RENDER_ARRAY] = [
       'onBuildRender',
       9999,
diff --git a/src/Hook/ConditionalRenderingHooks.php b/src/Hook/ConditionalRenderingHooks.php
new file mode 100644
index 0000000..130198b
--- /dev/null
+++ b/src/Hook/ConditionalRenderingHooks.php
@@ -0,0 +1,62 @@
+<?php
+
+namespace Drupal\conditional_rendering\Hook;
+
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\Core\Field\BaseFieldDefinition;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+
+/**
+ * Hook implementations for conditional_rendering.
+ */
+class ConditionalRenderingHooks {
+  use StringTranslationTrait;
+
+  /**
+   * Implements hook_entity_base_field_info().
+   */
+  #[Hook('entity_base_field_info')]
+  public function entityBaseFieldInfo(EntityTypeInterface $entity_type) {
+    if ($entity_type->id() === 'block_content') {
+      $fields = [];
+      $fields['conditional_rendering_action'] = BaseFieldDefinition::create('list_string')->setLabel($this->t('Conditional Rendering Action'))->setDescription($this->t('The action to be taken if the conditions are met.'))->setSetting('allowed_values', [
+        'show' => $this->t('Show'),
+        'hide' => $this->t('Hide'),
+      ])->setDisplayOptions('form', [
+        'type' => 'options_select',
+        'weight' => 0,
+      ])->setDisplayConfigurable('form', TRUE);
+      $fields['conditional_rendering_conditions'] = BaseFieldDefinition::create('conditional_rendering_condition')->setLabel($this->t('Conditions'))->setDescription($this->t('The conditions to be met for this block to be rendered.'))->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)->setDisplayOptions('form', [
+        'type' => 'conditional_rendering_condition',
+        'weight' => 0,
+      ])->setDisplayConfigurable('form', TRUE);
+      return $fields;
+    }
+  }
+
+  /**
+   * Implements hook_page_attachments().
+   */
+  #[Hook('page_attachments')]
+  public function pageAttachments(array &$page) {
+    $page['#attached']['library'][] = 'conditional_rendering/conditional_rendering';
+  }
+
+  /**
+   * Implements hook_preprocess_block().
+   */
+  #[Hook('preprocess_block')]
+  public function preprocessBlock(&$variables) {
+    // Adding a css class to identify a block with a conditional rendering set.
+    if (isset($variables['content']['#block_content'])) {
+      /** @var \Drupal\block_content\Entity\BlockContent $block **/
+      $block = $variables['content']['#block_content'];
+      if ($block->hasField('conditional_rendering_action') && $block->get('conditional_rendering_action')->value) {
+        $variables['attributes']['class'][] = 'conditional-rendering-block';
+      }
+    }
+  }
+
+}
