diff --git a/src/Controller/StaticFilesController.php b/src/Controller/StaticFilesController.php
index 5561af4..325bad4 100644
--- a/src/Controller/StaticFilesController.php
+++ b/src/Controller/StaticFilesController.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\static_node\Controller;
 
+use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
@@ -77,7 +78,7 @@ class StaticFilesController extends ControllerBase {
    * @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
    */
   protected $loggerFactory;
-  
+
   /**
    * The messenger service.
    *
@@ -126,7 +127,7 @@ class StaticFilesController extends ControllerBase {
     FileSystemInterface $file_system,
     LoggerChannelFactoryInterface $logger_factory,
     MessengerInterface $messenger,
-    FormBuilder $form_builder
+    FormBuilder $form_builder,
   ) {
     $this->entityTypeManager = $entity_type_manager;
     $this->fileUrlGenerator = $file_url_generator;
@@ -177,7 +178,7 @@ class StaticFilesController extends ControllerBase {
    *   A render array for the overview page.
    */
   public function overview() {
-    // Build the file table header
+    // Build the file table header.
     $header = [
       'checkbox' => ['data' => ''],
       'filename' => ['data' => $this->t('Static File'), 'field' => 'filename', 'sort' => 'asc'],
@@ -188,36 +189,36 @@ class StaticFilesController extends ControllerBase {
       'operations' => ['data' => $this->t('Operations')],
     ];
 
-    // Start building the page
+    // Start building the page.
     $build = [];
-    
-    // Add explanatory text
+
+    // Add explanatory text.
     $build['explanation'] = [
       '#markup' => '<p>' . $this->t('This page lists all static HTML files that have been generated. You can view, regenerate, or delete these files.') . '</p>',
     ];
-    
-    // Add action buttons
+
+    // Add action buttons.
     $build['actions'] = [
       '#type' => 'container',
       '#attributes' => ['class' => ['action-buttons', 'container-inline', 'margin-bottom']],
     ];
-    
-    // Homepage generation buttons
+
+    // Homepage generation buttons.
     $build['actions']['generate_homepage'] = [
       '#type' => 'link',
       '#title' => $this->t('Generate static homepage'),
       '#url' => Url::fromRoute('static_node.generate_homepage'),
       '#attributes' => ['class' => ['button', 'button-action']],
     ];
-    
+
     $build['actions']['delete_homepage'] = [
       '#type' => 'link',
       '#title' => $this->t('Delete static homepage'),
       '#url' => Url::fromRoute('static_node.delete_homepage'),
       '#attributes' => ['class' => ['button']],
     ];
-    
-    // Add custom path generation button
+
+    // Add custom path generation button.
     $build['actions']['generate_custom_path'] = [
       '#type' => 'link',
       '#title' => $this->t('Generate static page for custom path'),
@@ -225,36 +226,37 @@ class StaticFilesController extends ControllerBase {
       '#attributes' => ['class' => ['button', 'button-action']],
     ];
 
-    // Query for HTML files only
+    // Query for HTML files only.
     $query = $this->entityTypeManager->getStorage('file')->getQuery()
       ->condition('uri', 'public://' . $this->getStaticDirectoryName() . '/%', 'LIKE')
-      ->condition('uri', '%.html', 'LIKE') // Only show HTML files
+    // Only show HTML files.
+      ->condition('uri', '%.html', 'LIKE')
       ->sort('created', 'DESC')
       ->accessCheck(FALSE);
-    // Set up pagination
+    // Set up pagination.
     $query->pager(20);
     $fids = $query->execute();
-    
-    // Load the files
+
+    // Load the files.
     $files = $this->entityTypeManager->getStorage('file')->loadMultiple($fids);
-    // Create standard table rows
+    // Create standard table rows.
     $rows = [];
-    
+
     foreach ($files as $file) {
       $filepath = $file->getFileUri();
       $file_url = $this->fileUrlGenerator->generateAbsoluteString($filepath);
       $basename = basename($filepath);
       $file_path = $this->getFilePath($filepath);
-      
-      // Determine the file type based on the path or other attributes
+
+      // Determine the file type based on the path or other attributes.
       if (strpos($basename, 'index.html') !== FALSE || strpos($filepath, 'index.html') !== FALSE) {
         $type = $this->t('Homepage');
-      } 
+      }
       else {
         $type = $this->t('Node');
       }
-      
-      // Try to find the source node if available
+
+      // Try to find the source node if available.
       $source = '';
       if ($file->hasField('field_static_node') && !$file->field_static_node->isEmpty()) {
         $nid = $file->field_static_node->target_id;
@@ -272,18 +274,18 @@ class StaticFilesController extends ControllerBase {
           $this->loggerFactory->get('static_node')->error('Error loading source node: @error', ['@error' => $e->getMessage()]);
         }
       }
-      
-      // Create operations links properly
+
+      // Create operations links properly.
       $operations = [];
-      
-      // Add a link to view the static file
+
+      // Add a link to view the static file.
       $operations['view'] = [
         'title' => $this->t('View'),
         'url' => Url::fromUri($file_url),
         'attributes' => ['target' => '_blank'],
       ];
-      
-      // Add a delete operation if the user has permission
+
+      // Add a delete operation if the user has permission.
       if ($this->currentUser->hasPermission('delete static node')) {
         $operations['delete'] = [
           'title' => $this->t('Delete'),
@@ -291,8 +293,8 @@ class StaticFilesController extends ControllerBase {
         ];
       }
 
-      // If we have a source node and user has regenerate permission
-      if ($file->hasField('field_static_node') && !$file->field_static_node->isEmpty() && 
+      // If we have a source node and user has regenerate permission.
+      if ($file->hasField('field_static_node') && !$file->field_static_node->isEmpty() &&
           $this->currentUser->hasPermission('generate static node')) {
         $nid = $file->field_static_node->target_id;
         $operations['regenerate'] = [
@@ -300,18 +302,18 @@ class StaticFilesController extends ControllerBase {
           'url' => Url::fromRoute('static_node.regenerate_static_file', ['node' => $nid]),
         ];
       }
-      
-      // Get resources for this HTML file
+
+      // Get resources for this HTML file.
       $resources = [];
       if ($file_path && pathinfo($file_path, PATHINFO_EXTENSION) === 'html') {
         $resources = $this->scanHtmlForResources($file_path);
       }
-      
-      // Add toggle button for resources if resources exist
-      $has_resources = !empty($resources['css']) || !empty($resources['js']) || 
+
+      // Add toggle button for resources if resources exist.
+      $has_resources = !empty($resources['css']) || !empty($resources['js']) ||
                         !empty($resources['images']) || !empty($resources['other']);
-                        
-      // Checkbox column
+
+      // Checkbox column.
       $checkbox = [
         '#type' => 'checkbox',
         '#title' => $this->t('Select @title', ['@title' => $basename]),
@@ -319,8 +321,8 @@ class StaticFilesController extends ControllerBase {
         '#return_value' => $file->id(),
         '#attributes' => ['class' => ['file-select-checkbox']],
       ];
-      
-      // Filename column with toggle button
+
+      // Filename column with toggle button.
       if ($has_resources) {
         $filename_content = [
           '#type' => 'container',
@@ -343,7 +345,8 @@ class StaticFilesController extends ControllerBase {
             '#attributes' => ['target' => '_blank', 'class' => ['filename-link']],
           ],
         ];
-      } else {
+      }
+      else {
         $filename_content = [
           '#type' => 'link',
           '#title' => $basename,
@@ -351,15 +354,15 @@ class StaticFilesController extends ControllerBase {
           '#attributes' => ['target' => '_blank'],
         ];
       }
-      
-      // Operations column
+
+      // Operations column.
       $operations_dropdown = [
         '#type' => 'dropbutton',
         '#links' => $operations,
         '#attributes' => ['class' => ['operations-dropdown', 'dropbutton--extrasmall']],
       ];
 
-      // Build the row
+      // Build the row.
       $row = [
         'checkbox' => ['data' => $checkbox],
         'filename' => ['data' => $filename_content],
@@ -369,17 +372,17 @@ class StaticFilesController extends ControllerBase {
         'filesize' => ['data' => $this->formatFileSize($file->getSize())],
         'operations' => ['data' => $operations_dropdown],
       ];
-      
-      // Add row attributes
+
+      // Add row attributes.
       $row['#attributes']['data-file-id'] = $file->id();
       $rows[] = $row;
-      
-      // Add resource rows if we have resources
+
+      // Add resource rows if we have resources.
       if ($has_resources) {
-        // Process each resource type
+        // Process each resource type.
         foreach (['css', 'js', 'images', 'other'] as $type) {
           if (!empty($resources[$type])) {
-            // Add a header row for this resource type
+            // Add a header row for this resource type.
             $resource_header_row = [
               'data' => [
                 [
@@ -396,8 +399,8 @@ class StaticFilesController extends ControllerBase {
               'style' => 'display: none;',
             ];
             $rows[] = $resource_header_row;
-            
-            // Add rows for each resource
+
+            // Add rows for each resource.
             foreach ($resources[$type] as $resource_url) {
               $resource_row = [
                 'data' => [
@@ -418,7 +421,7 @@ class StaticFilesController extends ControllerBase {
       }
     }
 
-    // Add the table to the form
+    // Add the table to the form.
     $build['form']['files_table'] = [
       '#type' => 'table',
       '#header' => $header,
@@ -428,18 +431,18 @@ class StaticFilesController extends ControllerBase {
       '#attributes' => ['class' => ['static-files-table']],
       '#sticky' => TRUE,
     ];
-    
-    // Add the pager
+
+    // Add the pager.
     $build['form']['pager'] = [
       '#type' => 'pager',
     ];
-        
-    // Add bulk operations section
-    $build['form']['bulk_operations'] = $this->formBuilder->getForm(StaticFilesBulkOperationsForm::class);  
-    
-    // Attach CSS and JS
+
+    // Add bulk operations section.
+    $build['form']['bulk_operations'] = $this->formBuilder->getForm(StaticFilesBulkOperationsForm::class);
+
+    // Attach CSS and JS.
     $build['#attached']['library'][] = 'static_node/static_files_admin';
-    
+
     return $build;
   }
 
@@ -463,18 +466,19 @@ class StaticFilesController extends ControllerBase {
       'images' => [],
       'other' => [],
     ];
-    
-    // Read the file contents
+
+    // Read the file contents.
     $html = file_get_contents($file_path);
     if (!$html) {
       return $resources;
     }
-    
-    // Use DOMDocument to parse the HTML
+
+    // Use DOMDocument to parse the HTML.
     $dom = new \DOMDocument();
-    @$dom->loadHTML($html); // Suppress warnings for malformed HTML
-    
-    // Find CSS links
+    // Suppress warnings for malformed HTML.
+    @$dom->loadHTML($html);
+
+    // Find CSS links.
     $links = $dom->getElementsByTagName('link');
     foreach ($links as $link) {
       if ($link->getAttribute('rel') === 'stylesheet') {
@@ -484,8 +488,8 @@ class StaticFilesController extends ControllerBase {
         }
       }
     }
-    
-    // Find JavaScript
+
+    // Find JavaScript.
     $scripts = $dom->getElementsByTagName('script');
     foreach ($scripts as $script) {
       $src = $script->getAttribute('src');
@@ -493,8 +497,8 @@ class StaticFilesController extends ControllerBase {
         $resources['js'][] = $src;
       }
     }
-    
-    // Find images
+
+    // Find images.
     $images = $dom->getElementsByTagName('img');
     foreach ($images as $img) {
       $src = $img->getAttribute('src');
@@ -502,7 +506,7 @@ class StaticFilesController extends ControllerBase {
         $resources['images'][] = $src;
       }
     }
-    
+
     // Find other resources (e.g., video, audio)
     $otherTags = [
       'source' => 'src',
@@ -512,7 +516,7 @@ class StaticFilesController extends ControllerBase {
       'embed' => 'src',
       'object' => 'data',
     ];
-    
+
     foreach ($otherTags as $tag => $attr) {
       $elements = $dom->getElementsByTagName($tag);
       foreach ($elements as $element) {
@@ -522,7 +526,7 @@ class StaticFilesController extends ControllerBase {
         }
       }
     }
-    
+
     return $resources;
   }
 
@@ -562,39 +566,39 @@ class StaticFilesController extends ControllerBase {
    * @param \Drupal\Core\Form\FormStateInterface $form_state
    *   The form state.
    */
-  public function staticFilesBulkOperationsSubmit(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
-    // Get the selected files and action
+  public function staticFilesBulkOperationsSubmit(array &$form, FormStateInterface $form_state) {
+    // Get the selected files and action.
     $selected_files = array_filter($form_state->getValue('files_table'));
     $action = $form_state->getValue('action');
-    
+
     if (empty($selected_files)) {
       $this->messenger->addWarning($this->t('No items selected.'));
       return;
     }
-    
-    // Store selected files in tempstore based on action
+
+    // Store selected files in tempstore based on action.
     $tempstore_key = 'static_node_bulk_' . $action;
     $tempstore = \Drupal::service('tempstore.private')->get($tempstore_key);
     $tempstore->set($this->currentUser->id(), array_keys($selected_files));
-    
-    // Store destination for return after confirmation
+
+    // Store destination for return after confirmation.
     $destination_tempstore = \Drupal::service('tempstore.private')->get('static_node');
     $destination = \Drupal::destination()->get();
     $destination_tempstore->set('bulk_' . $action . '_destination', $destination);
-    
-    // Determine which form to use
+
+    // Determine which form to use.
     $route_name = '';
     switch ($action) {
       case 'delete':
         $route_name = 'static_node.bulk_delete_confirm';
         break;
-        
+
       case 'regenerate':
         $route_name = 'static_node.bulk_generate_confirm';
         break;
     }
-    
-    // Redirect to the confirmation form
+
+    // Redirect to the confirmation form.
     $options = [
       'attributes' => [
         'class' => ['use-ajax'],
@@ -604,8 +608,9 @@ class StaticFilesController extends ControllerBase {
         ]),
       ],
     ];
-    
+
     $url = Url::fromRoute($route_name, [], $options);
     $form_state->setRedirectUrl($url);
   }
-}
\ No newline at end of file
+
+}
diff --git a/src/Form/BulkDeleteStaticConfirmForm.php b/src/Form/BulkDeleteStaticConfirmForm.php
index 3a90e84..35275e0 100644
--- a/src/Form/BulkDeleteStaticConfirmForm.php
+++ b/src/Form/BulkDeleteStaticConfirmForm.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\static_node\Form;
 
+use Drupal\Core\Form\FormState;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\ConfirmFormBase;
 use Drupal\Core\Form\FormStateInterface;
@@ -67,7 +68,7 @@ class BulkDeleteStaticConfirmForm extends ConfirmFormBase {
     PrivateTempStoreFactory $temp_store_factory,
     EntityTypeManagerInterface $entity_type_manager,
     AccountInterface $current_user,
-    StaticNodeHooks $static_node_service
+    StaticNodeHooks $static_node_service,
   ) {
     $this->tempStoreFactory = $temp_store_factory;
     $this->entityTypeManager = $entity_type_manager;
@@ -109,15 +110,15 @@ class BulkDeleteStaticConfirmForm extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function getCancelUrl() {
-    // Check if there's a stored destination from the bulk action
+    // Check if there's a stored destination from the bulk action.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $destination = $tempstore->get('bulk_delete_destination');
-    
+
     if ($destination) {
       return Url::fromUserInput('/' . $destination);
     }
-    
-    // Default to admin content page if no destination stored
+
+    // Default to admin content page if no destination stored.
     return new Url('system.admin');
   }
 
@@ -144,24 +145,24 @@ class BulkDeleteStaticConfirmForm extends ConfirmFormBase {
     $node_ids = $this->tempStoreFactory
       ->get('static_node_bulk_delete')
       ->get($this->currentUser->id());
-    
+
     if (!$node_ids) {
       return $this->redirect('system.admin');
     }
-    
+
     $this->nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($node_ids);
-    
+
     $items = [];
     foreach ($this->nodes as $node) {
       $items[] = $node->label();
     }
-    
+
     $form['nodes'] = [
       '#theme' => 'item_list',
       '#title' => $this->t('The following content items will have static pages deleted:'),
       '#items' => $items,
     ];
-    
+
     return parent::buildForm($form, $form_state);
   }
 
@@ -173,22 +174,22 @@ class BulkDeleteStaticConfirmForm extends ConfirmFormBase {
       $this->messenger()->addWarning($this->t('No content items were selected for static page deletion.'));
       return;
     }
-    
+
     // Process each node.
     $temp_form = [];
     $processed = 0;
-    
+
     foreach ($this->nodes as $node) {
-      // Create a new form state and set the node
-      $node_form_state = new \Drupal\Core\Form\FormState();
+      // Create a new form state and set the node.
+      $node_form_state = new FormState();
       $node_form_state->set('node', $node);
-      
-      // Delete the static version using the service
+
+      // Delete the static version using the service.
       $this->staticNodeService->deleteStaticVersion($temp_form, $node_form_state);
-      
+
       $processed++;
     }
-    
+
     // Report the results.
     if ($processed > 0) {
       $this->messenger()->addStatus($this->formatPlural(
@@ -197,23 +198,23 @@ class BulkDeleteStaticConfirmForm extends ConfirmFormBase {
         'Deleted @count static pages successfully.'
       ));
     }
-    
+
     // Delete the tempstore.
     $this->tempStoreFactory
       ->get('static_node_bulk_delete')
       ->delete($this->currentUser->id());
-    
-    // Get stored destination
+
+    // Get stored destination.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $destination = $tempstore->get('bulk_delete_destination');
-    
-    // Clean up the stored destination
+
+    // Clean up the stored destination.
     if ($destination) {
       $tempstore->delete('bulk_delete_destination');
       $form_state->setRedirectUrl(Url::fromUserInput('/' . $destination));
     }
     else {
-      // Check for the destination query parameter as fallback
+      // Check for the destination query parameter as fallback.
       $request = \Drupal::requestStack()->getCurrentRequest();
       if ($request->query->has('destination')) {
         $destination = $request->query->get('destination');
@@ -225,4 +226,5 @@ class BulkDeleteStaticConfirmForm extends ConfirmFormBase {
       }
     }
   }
+
 }
diff --git a/src/Form/BulkGenerateStaticConfirmForm.php b/src/Form/BulkGenerateStaticConfirmForm.php
index ad10026..76de822 100644
--- a/src/Form/BulkGenerateStaticConfirmForm.php
+++ b/src/Form/BulkGenerateStaticConfirmForm.php
@@ -2,6 +2,10 @@
 
 namespace Drupal\static_node\Form;
 
+use Drupal\Core\Form\FormState;
+use Drupal\Core\Ajax\AjaxResponse;
+use Drupal\Core\Ajax\CloseModalDialogCommand;
+use Drupal\Core\Ajax\RedirectCommand;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\ConfirmFormBase;
 use Drupal\Core\Form\FormStateInterface;
@@ -67,7 +71,7 @@ class BulkGenerateStaticConfirmForm extends ConfirmFormBase {
     PrivateTempStoreFactory $temp_store_factory,
     EntityTypeManagerInterface $entity_type_manager,
     AccountInterface $current_user,
-    StaticNodeHooks $static_node_service
+    StaticNodeHooks $static_node_service,
   ) {
     $this->tempStoreFactory = $temp_store_factory;
     $this->entityTypeManager = $entity_type_manager;
@@ -109,15 +113,15 @@ class BulkGenerateStaticConfirmForm extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function getCancelUrl() {
-    // Check if there's a stored destination from the bulk action
+    // Check if there's a stored destination from the bulk action.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $destination = $tempstore->get('bulk_destination');
-    
+
     if ($destination) {
       return Url::fromUserInput('/' . $destination);
     }
-    
-    // Default to admin content page if no destination stored
+
+    // Default to admin content page if no destination stored.
     return new Url('system.admin');
   }
 
@@ -144,34 +148,34 @@ class BulkGenerateStaticConfirmForm extends ConfirmFormBase {
     $node_ids = $this->tempStoreFactory
       ->get('static_node_bulk_generate')
       ->get($this->currentUser->id());
-    
+
     if (!$node_ids) {
       return $this->redirect('system.admin');
     }
-    
+
     $this->nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($node_ids);
-    
+
     $items = [];
     foreach ($this->nodes as $node) {
       $items[] = $node->label();
     }
-    
+
     $form['nodes'] = [
       '#theme' => 'item_list',
       '#title' => $this->t('The following content items will have static pages generated:'),
       '#items' => $items,
     ];
-    
+
     $form = parent::buildForm($form, $form_state);
 
-    // Add AJAX modal support
+    // Add AJAX modal support.
     $form['actions']['submit']['#ajax'] = [
       'callback' => '::ajaxSubmit',
       'event' => 'click',
     ];
 
     $form['actions']['cancel']['#attributes']['class'][] = 'dialog-cancel';
-    
+
     return $form;
   }
 
@@ -183,22 +187,22 @@ class BulkGenerateStaticConfirmForm extends ConfirmFormBase {
       $this->messenger()->addWarning($this->t('No content items were selected for static page generation.'));
       return;
     }
-    
+
     // Process each node.
     $temp_form = [];
     $processed = 0;
-    
+
     foreach ($this->nodes as $node) {
-      // Create a new form state and set the node
-      $node_form_state = new \Drupal\Core\Form\FormState();
+      // Create a new form state and set the node.
+      $node_form_state = new FormState();
       $node_form_state->set('node', $node);
-      
-      // Generate the static version using the service
+
+      // Generate the static version using the service.
       $this->staticNodeService->generateStaticVersion($temp_form, $node_form_state);
-      
+
       $processed++;
     }
-    
+
     // Report the results.
     if ($processed > 0) {
       $this->messenger()->addStatus($this->formatPlural(
@@ -207,23 +211,23 @@ class BulkGenerateStaticConfirmForm extends ConfirmFormBase {
         'Generated @count static pages successfully.'
       ));
     }
-    
-    // Delete the tempstore data
+
+    // Delete the tempstore data.
     $this->tempStoreFactory
       ->get('static_node_bulk_generate')
       ->delete($this->currentUser->id());
-    
-    // Get stored destination
+
+    // Get stored destination.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $destination = $tempstore->get('bulk_destination');
-    
-    // Clean up the stored destination
+
+    // Clean up the stored destination.
     if ($destination) {
       $tempstore->delete('bulk_destination');
       $form_state->setRedirectUrl(Url::fromUserInput('/' . $destination));
     }
     else {
-      // Check for the destination query parameter as fallback
+      // Check for the destination query parameter as fallback.
       $request = \Drupal::requestStack()->getCurrentRequest();
       if ($request->query->has('destination')) {
         $destination = $request->query->get('destination');
@@ -248,25 +252,26 @@ class BulkGenerateStaticConfirmForm extends ConfirmFormBase {
    *   An AJAX response that will close the modal and redirect to the overview page.
    */
   public function ajaxSubmit(array &$form, FormStateInterface $form_state) {
-    $response = new \Drupal\Core\Ajax\AjaxResponse();
-    
-    // Display messages for this operation first
-    $response->addCommand(new \Drupal\Core\Ajax\CloseModalDialogCommand());
-    
-    // Get the destination URL
+    $response = new AjaxResponse();
+
+    // Display messages for this operation first.
+    $response->addCommand(new CloseModalDialogCommand());
+
+    // Get the destination URL.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $destination = $tempstore->get('bulk_destination');
-    
-    // Redirect to the destination after closing the modal
+
+    // Redirect to the destination after closing the modal.
     if ($destination) {
-      $response->addCommand(new \Drupal\Core\Ajax\RedirectCommand($destination));
+      $response->addCommand(new RedirectCommand($destination));
     }
     else {
-      // Fallback to files management page if no destination
+      // Fallback to files management page if no destination.
       $url = Url::fromRoute('static_node.files_management')->toString();
-      $response->addCommand(new \Drupal\Core\Ajax\RedirectCommand($url));
+      $response->addCommand(new RedirectCommand($url));
     }
-    
+
     return $response;
   }
+
 }
diff --git a/src/Form/StaticFileDeleteFileForm.php b/src/Form/StaticFileDeleteFileForm.php
index fb79b62..01bb4d2 100644
--- a/src/Form/StaticFileDeleteFileForm.php
+++ b/src/Form/StaticFileDeleteFileForm.php
@@ -62,7 +62,7 @@ class StaticFileDeleteFileForm extends ConfirmFormBase {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, FileInterface $file = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?FileInterface $file = NULL) {
     $this->file = $file;
     return parent::buildForm($form, $form_state);
   }
@@ -100,11 +100,12 @@ class StaticFileDeleteFileForm extends ConfirmFormBase {
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
     if ($this->file) {
-      // Delete the file entity which will also remove the physical file
+      // Delete the file entity which will also remove the physical file.
       $this->file->delete();
       $this->messenger->addStatus($this->t('Static file %name has been deleted.', ['%name' => $this->file->getFilename()]));
     }
-    
+
     $form_state->setRedirectUrl(new Url('static_node.files_management'));
   }
-}
\ No newline at end of file
+
+}
diff --git a/src/Form/StaticFileDeleteForm.php b/src/Form/StaticFileDeleteForm.php
index 64f836b..f5e5d2c 100644
--- a/src/Form/StaticFileDeleteForm.php
+++ b/src/Form/StaticFileDeleteForm.php
@@ -69,7 +69,7 @@ class StaticFileDeleteForm extends ConfirmFormBase {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $node = NULL) {
     $this->node = $node;
     return parent::buildForm($form, $form_state);
   }
@@ -106,26 +106,27 @@ class StaticFileDeleteForm extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    // Create an empty form array
+    // Create an empty form array.
     $temp_form = [];
-    // Use the existing form state and set the node
+    // Use the existing form state and set the node.
     $form_state->set('node', $this->node);
-    
-    // Delete the static version using the service
+
+    // Delete the static version using the service.
     $this->staticNodeService->deleteStaticVersion($temp_form, $form_state);
-    
-    // Check if we have a stored original destination to return to
+
+    // Check if we have a stored original destination to return to.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $original_destination = $tempstore->get('original_destination_' . $this->node->id());
-    
+
     if ($original_destination) {
-      // Clear the stored value as we've used it
+      // Clear the stored value as we've used it.
       $tempstore->delete('original_destination_' . $this->node->id());
       $form_state->setRedirectUrl(Url::fromUserInput('/' . $original_destination));
     }
     else {
-      // Default to returning to the node
+      // Default to returning to the node.
       $form_state->setRedirectUrl(new Url('entity.node.canonical', ['node' => $this->node->id()]));
     }
   }
+
 }
diff --git a/src/Form/StaticFileGenerateForm.php b/src/Form/StaticFileGenerateForm.php
index 6ed9cdd..5ee2739 100644
--- a/src/Form/StaticFileGenerateForm.php
+++ b/src/Form/StaticFileGenerateForm.php
@@ -69,7 +69,7 @@ class StaticFileGenerateForm extends ConfirmFormBase {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $node = NULL) {
     $this->node = $node;
     return parent::buildForm($form, $form_state);
   }
@@ -106,46 +106,47 @@ class StaticFileGenerateForm extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    // Create an empty form array
+    // Create an empty form array.
     $temp_form = [];
-    // Use the existing form state
+    // Use the existing form state.
     $form_state->set('node', $this->node);
-    
-    // Log for debugging
+
+    // Log for debugging.
     \Drupal::logger('static_node')->info('Generate static file for node @nid', ['@nid' => $this->node->id()]);
-    
-    // Generate the static version using the service
+
+    // Generate the static version using the service.
     $this->staticNodeService->generateStaticVersion($temp_form, $form_state);
-    
-    // Check if we have a stored original destination to return to
+
+    // Check if we have a stored original destination to return to.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $original_destination = $tempstore->get('original_destination_' . $this->node->id());
-    
+
     \Drupal::logger('static_node')->info('Original destination for node @nid: @dest', [
       '@nid' => $this->node->id(),
       '@dest' => $original_destination ?: 'none',
     ]);
-    
+
     if ($original_destination) {
-      // Clear the stored value as we've used it
+      // Clear the stored value as we've used it.
       $tempstore->delete('original_destination_' . $this->node->id());
-      
+
       // Make sure not to redirect to /content (which may not exist)
       if ($original_destination === 'content' || $original_destination === '/content') {
         $original_destination = 'admin/content';
       }
-      
-      // Handle both absolute and relative paths
+
+      // Handle both absolute and relative paths.
       if (strpos($original_destination, '/') === 0) {
         $form_state->setRedirectUrl(Url::fromUserInput($original_destination));
-      } else {
+      }
+      else {
         $form_state->setRedirectUrl(Url::fromUserInput('/' . $original_destination));
       }
     }
     else {
-      // Default to returning to the node view page
+      // Default to returning to the node view page.
       $form_state->setRedirectUrl(new Url('entity.node.canonical', ['node' => $this->node->id()]));
     }
   }
 
-}
\ No newline at end of file
+}
diff --git a/src/Form/StaticFileRegenerateForm.php b/src/Form/StaticFileRegenerateForm.php
index b9680b3..1b64a20 100644
--- a/src/Form/StaticFileRegenerateForm.php
+++ b/src/Form/StaticFileRegenerateForm.php
@@ -69,7 +69,7 @@ class StaticFileRegenerateForm extends ConfirmFormBase {
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL) {
+  public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $node = NULL) {
     $this->node = $node;
     return parent::buildForm($form, $form_state);
   }
@@ -106,27 +106,28 @@ class StaticFileRegenerateForm extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    // Create an empty form array
+    // Create an empty form array.
     $temp_form = [];
-    // Use the existing form state and set the node
+    // Use the existing form state and set the node.
     $form_state->set('node', $this->node);
-    
-    // Generate the static version using the service
+
+    // Generate the static version using the service.
     $this->staticNodeService->generateStaticVersion($temp_form, $form_state);
-    
-    // Check if we have a stored original destination to return to
+
+    // Check if we have a stored original destination to return to.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $original_destination = $tempstore->get('original_destination_' . $this->node->id());
-    
+
     if ($original_destination) {
-      // Clear the stored value as we've used it
+      // Clear the stored value as we've used it.
       $tempstore->delete('original_destination_' . $this->node->id());
       $form_state->setRedirectUrl(Url::fromUserInput('/' . $original_destination));
     }
     else {
-      
-      // Default to returning to the node
+
+      // Default to returning to the node.
       $form_state->setRedirectUrl(new Url('static_node.files_management'));
     }
   }
+
 }
diff --git a/src/Form/StaticFilesBulkDeleteConfirmForm.php b/src/Form/StaticFilesBulkDeleteConfirmForm.php
index 6455b3e..e3bc766 100644
--- a/src/Form/StaticFilesBulkDeleteConfirmForm.php
+++ b/src/Form/StaticFilesBulkDeleteConfirmForm.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\static_node\Form;
 
+use Drupal\Core\Form\FormState;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
@@ -48,7 +49,7 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
    * @var \Drupal\static_node\Service\StaticNodeHooks
    */
   protected $staticNodeService;
-  
+
   /**
    * The messenger service.
    *
@@ -92,7 +93,7 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
     AccountInterface $current_user,
     StaticNodeHooks $static_node_service,
     MessengerInterface $messenger,
-    LoggerChannelFactoryInterface $logger_factory
+    LoggerChannelFactoryInterface $logger_factory,
   ) {
     $this->tempStoreFactory = $temp_store_factory;
     $this->entityTypeManager = $entity_type_manager;
@@ -122,42 +123,42 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
   public function getFormId() {
     return 'static_files_bulk_delete_confirm';
   }
-  
+
   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state) {
-    // Ensure we have the proper libraries
+    // Ensure we have the proper libraries.
     $form['#attached']['library'][] = 'core/drupal.dialog.ajax';
     $form['#attached']['library'][] = 'core/drupal.ajax';
-    
-    // Set proper form ID and wrapper
+
+    // Set proper form ID and wrapper.
     $form['#id'] = 'static-files-bulk-delete-form';
     $form['#prefix'] = '<div id="static-files-bulk-delete-form">';
     $form['#suffix'] = '</div>';
-    
-    // Get selected items from tempstore
+
+    // Get selected items from tempstore.
     $tempstore = $this->tempStoreFactory->get('static_node_bulk_delete');
     $selected_items = $tempstore->get($this->currentUser->id());
-    
+
     if (empty($selected_items)) {
       $this->messenger->addError($this->t('No files were selected for deletion.'));
       return $form;
     }
-    
-    // Store the file IDs
+
+    // Store the file IDs.
     $this->fileIds = $selected_items;
     $form_state->set('selected_items', $selected_items);
-    
-    // Load the file entities
+
+    // Load the file entities.
     $files = $this->entityTypeManager->getStorage('file')->loadMultiple($selected_items);
-    
+
     if (empty($files)) {
       $this->messenger->addError($this->t('No files were found for deletion.'));
       return $form;
     }
-    
-    // Add a dedicated container for displaying messages in the modal
+
+    // Add a dedicated container for displaying messages in the modal.
     $form['messages_container'] = [
       '#type' => 'container',
       '#attributes' => [
@@ -165,10 +166,10 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
         'class' => ['messages-container'],
       ],
     ];
-    
+
     $items = [];
     foreach ($files as $file) {
-      // Try to find the source node if available
+      // Try to find the source node if available.
       if ($file->hasField('field_static_node') && !$file->field_static_node->isEmpty()) {
         $nid = $file->field_static_node->target_id;
         try {
@@ -184,28 +185,28 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
         }
       }
     }
-    
+
     $form['title'] = [
       '#type' => 'markup',
       '#markup' => '<h3>' . $this->t('Delete Static Files') . '</h3>',
     ];
-    
+
     $form['description'] = [
       '#markup' => '<p>' . $this->t('This will delete the static HTML versions of these pages. The original content will not be affected, but anonymous users will see the dynamic version of the pages instead.') . '</p>',
     ];
-    
+
     $form['files'] = [
       '#theme' => 'item_list',
       '#items' => $items,
       '#title' => $this->formatPlural(count($files), '1 file selected for deletion:', '@count files selected for deletion:'),
     ];
-    
+
     $form['nodes_items'] = [
       '#type' => 'hidden',
       '#default_value' => implode(',', $this->fileIds),
     ];
-    
-    // Add actions with proper AJAX configuration
+
+    // Add actions with proper AJAX configuration.
     $form['actions'] = [
       '#type' => 'actions',
     ];
@@ -223,7 +224,7 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
         ],
       ],
     ];
-    
+
     $form['actions']['cancel'] = [
       '#type' => 'button',
       '#value' => $this->t('Cancel'),
@@ -232,7 +233,7 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
       ],
       '#attributes' => ['class' => ['dialog-cancel']],
     ];
-    
+
     return $form;
   }
 
@@ -249,30 +250,30 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
    * AJAX submit callback for the form.
    */
   public function ajaxSubmit(array &$form, FormStateInterface $form_state) {
-    // Special handling for AJAX submission
+    // Special handling for AJAX submission.
     $form_state->setRebuild(FALSE);
     $this->submitForm($form, $form_state);
-    
+
     $response = new AjaxResponse();
-    
-    // Add command to close the modal dialog
+
+    // Add command to close the modal dialog.
     $response->addCommand(new CloseModalDialogCommand());
-    
-    // Get the destination URL for redirection
+
+    // Get the destination URL for redirection.
     $tempstore = $this->tempStoreFactory->get('static_node');
     $destination = $tempstore->get('bulk_delete_destination');
-    
-    // Add the redirect command
+
+    // Add the redirect command.
     if ($destination) {
       $tempstore->delete('bulk_delete_destination');
       $response->addCommand(new RedirectCommand($destination));
     }
     else {
-      // Fallback to files management page if no destination stored
+      // Fallback to files management page if no destination stored.
       $url = Url::fromRoute('static_node.files_management')->toString();
       $response->addCommand(new RedirectCommand($url));
     }
-    
+
     return $response;
   }
 
@@ -281,60 +282,60 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $this->loggerFactory->get('static_node')->debug('Delete form submission started');
-    
-    // Get selected items
+
+    // Get selected items.
     $selected_items = $form_state->get('selected_items');
-    
+
     if (empty($selected_items)) {
       $nodes_items = $form_state->getValue('nodes_items');
       $this->loggerFactory->get('static_node')->debug('Trying to get items from nodes_items field: @items', ['@items' => $nodes_items]);
-      
+
       if (!empty($nodes_items)) {
         $selected_items = explode(',', $nodes_items);
       }
     }
-    
+
     if (empty($selected_items)) {
       $this->loggerFactory->get('static_node')->warning('No items selected for static file deletion');
       $this->messenger->addError($this->t('No items were selected for static file deletion.'));
       return;
     }
-    
+
     $this->loggerFactory->get('static_node')->debug('Processing @count items for deletion', ['@count' => count($selected_items)]);
-    
-    // Process each file
+
+    // Process each file.
     $processed = 0;
     $errors = 0;
-    
+
     $files = $this->entityTypeManager->getStorage('file')->loadMultiple($selected_items);
-    
+
     foreach ($files as $file) {
       try {
-        // Try to find the source node if available
+        // Try to find the source node if available.
         if ($file->hasField('field_static_node') && !$file->field_static_node->isEmpty()) {
           $nid = $file->field_static_node->target_id;
-          
+
           try {
             $node = $this->entityTypeManager->getStorage('node')->load($nid);
             if ($node) {
               $this->loggerFactory->get('static_node')->debug('Deleting static version for node @nid (@title)', [
                 '@nid' => $node->id(),
-                '@title' => $node->getTitle()
+                '@title' => $node->getTitle(),
               ]);
-              
-              // Create a temporary form array and form state for the static node service
+
+              // Create a temporary form array and form state for the static node service.
               $temp_form = [];
-              $temp_form_state = new \Drupal\Core\Form\FormState();
+              $temp_form_state = new FormState();
               $temp_form_state->set('node', $node);
-              
-              // Delete the static version using the service
+
+              // Delete the static version using the service.
               $this->staticNodeService->deleteStaticVersion($temp_form, $temp_form_state);
               $processed++;
               $this->loggerFactory->get('static_node')->info('Static file deleted successfully for node @nid', ['@nid' => $nid]);
             }
             else {
               $this->loggerFactory->get('static_node')->warning('Node @nid not found, attempting to delete the file directly', ['@nid' => $nid]);
-              // If node not found, try to delete the file directly
+              // If node not found, try to delete the file directly.
               $file->delete();
               $processed++;
             }
@@ -343,12 +344,12 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
             $errors++;
             $this->loggerFactory->get('static_node')->error('Error deleting static file for node @nid: @error', [
               '@nid' => $nid,
-              '@error' => $e->getMessage()
+              '@error' => $e->getMessage(),
             ]);
           }
         }
         else {
-          // If no node reference, delete the file directly
+          // If no node reference, delete the file directly.
           $this->loggerFactory->get('static_node')->info('File @fid has no source node, deleting directly', ['@fid' => $file->id()]);
           $file->delete();
           $processed++;
@@ -358,25 +359,25 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
         $errors++;
         $this->loggerFactory->get('static_node')->error('Error deleting file @fid: @error', [
           '@fid' => $file->id(),
-          '@error' => $e->getMessage()
+          '@error' => $e->getMessage(),
         ]);
       }
     }
-    
+
     $this->loggerFactory->get('static_node')->info('Deletion completed. @processed deleted, @errors failed', [
       '@processed' => $processed,
-      '@errors' => $errors
+      '@errors' => $errors,
     ]);
-    
-    // Store messages in the session so they persist
+
+    // Store messages in the session so they persist.
     if ($processed > 0) {
-      $message = $this->formatPlural($processed, 
-        '1 static file was successfully deleted.', 
+      $message = $this->formatPlural($processed,
+        '1 static file was successfully deleted.',
         '@count static files were successfully deleted.'
       );
       $this->messenger->addStatus($message);
     }
-    
+
     if ($errors > 0) {
       $message = $this->formatPlural($errors,
         'Failed to delete 1 static file. Check the logs for more information.',
@@ -384,13 +385,14 @@ class StaticFilesBulkDeleteConfirmForm extends FormBase {
       );
       $this->messenger->addError($message);
     }
-    
+
     if ($processed == 0 && $errors == 0) {
       $message = $this->t('No static files were deleted.');
       $this->messenger->addWarning($message);
     }
-    
-    // Clear the tempstore data
+
+    // Clear the tempstore data.
     $this->tempStoreFactory->get('static_node_bulk_delete')->delete($this->currentUser->id());
   }
-}
\ No newline at end of file
+
+}
diff --git a/src/Form/StaticFilesBulkGenerateConfirmForm.php b/src/Form/StaticFilesBulkGenerateConfirmForm.php
index 856d25b..d9229d9 100644
--- a/src/Form/StaticFilesBulkGenerateConfirmForm.php
+++ b/src/Form/StaticFilesBulkGenerateConfirmForm.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\static_node\Form;
 
+use Drupal\file\FileInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
@@ -50,7 +51,7 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
    * @var \Drupal\static_node\Service\StaticNodeHooks
    */
   protected $staticNodeService;
-  
+
   /**
    * The messenger service.
    *
@@ -94,7 +95,7 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
     AccountInterface $current_user,
     StaticNodeHooks $static_node_service,
     MessengerInterface $messenger,
-    LoggerChannelFactoryInterface $logger_factory
+    LoggerChannelFactoryInterface $logger_factory,
   ) {
     $this->tempStoreFactory = $temp_store_factory;
     $this->entityTypeManager = $entity_type_manager;
@@ -124,13 +125,13 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
   public function getFormId() {
     return 'static_files_bulk_generate_confirm';
   }
-  
+
   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state, $selected_items = NULL) {
-    
-    // Check if the user has permission to generate static files
+
+    // Check if the user has permission to generate static files.
     if (!$this->currentUser->hasPermission('generate static node')) {
       $this->logger('static_node')->error('You do not have permission to generate static files.');
       $this->messenger->addError($this->t('You do not have permission to generate static files.'));
@@ -139,34 +140,34 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
     $form['#attached']['library'][] = 'core/drupal.dialog';
     $form['#attached']['library'][] = 'core/drupal.dialog.ajax';
 
-    // Set proper form ID and wrapper
+    // Set proper form ID and wrapper.
     $form['#prefix'] = '<div id="static-files-bulk-generate-wrapper">';
     $form['#suffix'] = '</div>';
-    
-    // Get selected items from tempstore
+
+    // Get selected items from tempstore.
     $tempstore = $this->tempStoreFactory->get('static_node_bulk_generate');
     $selected_items = $tempstore->get($this->currentUser->id());
-    
+
     if (empty($selected_items)) {
       $this->logger('static_node')->error('No files were selected for static file generation.');
       $this->messenger->addError($this->t('No files were selected for static file generation.'));
       return $form;
     }
-    
-    // Store the file IDs
+
+    // Store the file IDs.
     $this->fileIds = $selected_items;
     $form_state->set('selected_items', $selected_items);
-    
-    // Load the file entities
+
+    // Load the file entities.
     $files = $this->entityTypeManager->getStorage('file')->loadMultiple($selected_items);
-    
+
     if (empty($files)) {
       $this->logger('static_node')->error('No files were found for static file generation.');
       $this->messenger->addError($this->t('No files were found for static file generation.'));
       return $form;
     }
-    
-    // Add a dedicated container for displaying messages in the modal
+
+    // Add a dedicated container for displaying messages in the modal.
     $form['messages_container'] = [
       '#type' => 'container',
       '#attributes' => [
@@ -174,14 +175,14 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
         'class' => ['messages-container'],
       ],
     ];
-    
+
     $items = [];
     foreach ($files as $file) {
-      // Cehck if file is file entity
-      if (!$file instanceof \Drupal\file\FileInterface) {
+      // Cehck if file is file entity.
+      if (!$file instanceof FileInterface) {
         continue;
       }
-      // Try to find the source node if available
+      // Try to find the source node if available.
       if ($file->hasField('field_static_node') && !$file->field_static_node->isEmpty()) {
         $nid = $file->field_static_node->target_id;
         try {
@@ -200,28 +201,28 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
         }
       }
     }
-    
+
     $form['title'] = [
       '#type' => 'markup',
       '#markup' => '<h3>' . $this->t('Generate Static Files') . '</h3>',
     ];
-    
+
     $form['description'] = [
       '#markup' => '<p>' . $this->t('This will create static HTML versions of these pages which will be served to anonymous users for better performance.') . '</p>',
     ];
-    
+
     $form['files'] = [
       '#theme' => 'item_list',
       '#items' => $items,
       '#title' => $this->formatPlural(count($files), '1 file selected for static generation:', '@count files selected for static generation:'),
     ];
-    
+
     $form['nodes_items'] = [
       '#type' => 'hidden',
       '#default_value' => $selected_items,
     ];
-    
-    // Add actions with proper AJAX configuration
+
+    // Add actions with proper AJAX configuration.
     $form['actions'] = [
       '#type' => 'actions',
       '#prefix' => '<div class="form-actions">',
@@ -246,7 +247,7 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
         ],
       ],
     ];
-    
+
     $form['actions']['cancel'] = [
       '#type' => 'submit',
       '#value' => $this->t('Cancel'),
@@ -263,8 +264,7 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
    */
   public function validateForm(array &$form, FormStateInterface $form_state) {
     // No validation needed for this form
-    // but we can check if the user has permission to generate static files
-
+    // but we can check if the user has permission to generate static files.
     $this->logger('static_node')->debug('StaticFilesBulkGenerateConfirmForm: validateForm() called.');
   }
 
@@ -283,7 +283,7 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
    * AJAX submit callback for the form.
    */
   public function generateStaticFiles(array &$form, FormStateInterface $form_state) {
-    // Get the file IDs from the form state
+    // Get the file IDs from the form state.
     $this->logger('static_node')->debug('StaticFilesBulkGenerateConfirmForm: generateStaticFiles() called.');
     $file_ids = $form_state->getValue('nodes_items');
     $response = new AjaxResponse();
@@ -295,20 +295,20 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
     elseif (!is_array($file_ids)) {
       $file_ids = [];
     }
-    
+
     if (empty($file_ids)) {
       $message .= $this->t('No files were selected for static file generation.');
     }
-    
+
     $success_count = 0;
     $fail_count = 0;
-    
+
     foreach ($file_ids as $file_id) {
       if (!is_numeric($file_id) || empty($file_id)) {
         continue;
       }
-      
-      // Try to find the source node if available
+
+      // Try to find the source node if available.
       $file = $this->entityTypeManager->getStorage('file')->load($file_id);
       if ($file && $file->hasField('field_static_node') && !$file->field_static_node->isEmpty()) {
         $nid = $file->field_static_node->target_id;
@@ -332,33 +332,32 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
         }
       }
     }
-    
-    // Provide feedback
+
+    // Provide feedback.
     if ($success_count > 0) {
-      $message .= $this->formatPlural($success_count, 
-        '1 static file was generated successfully. ', 
+      $message .= $this->formatPlural($success_count,
+        '1 static file was generated successfully. ',
         '@count static files were generated successfully. '
       );
     }
     if ($fail_count > 0) {
-      $message .= $this->formatPlural($fail_count, 
-        '1 file failed to generate. ', 
+      $message .= $this->formatPlural($fail_count,
+        '1 file failed to generate. ',
         '@count files failed to generate. '
       );
     }
-    
-    // Clean up the tempstore
+
+    // Clean up the tempstore.
     $tempstore = $this->tempStoreFactory->get('static_node_bulk_generate');
     $tempstore->delete($this->currentUser->id());
 
-
     $response->addCommand(new CloseDialogCommand('#static-files-bulk-form-modal'));
 
     $this->logger('static_node')->debug('StaticFilesBulkGenerateConfirmForm: generateStaticFiles() called.');
-    
+
     $this->messenger->addStatus($message, 'status', TRUE);
 
-    // Redirect to files page
+    // Redirect to files page.
     $url = Url::fromRoute('static_node.files_management');
     $response->addCommand(new RedirectCommand($url->toString()));
 
@@ -369,7 +368,8 @@ class StaticFilesBulkGenerateConfirmForm extends FormBase {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    //$form_state->setRebuild(TRUE);
+    // $form_state->setRebuild(TRUE);
     $this->logger('static_node')->debug('StaticFilesBulkGenerateConfirmForm: submitForm() called.');
   }
-}
\ No newline at end of file
+
+}
diff --git a/src/Form/StaticNodeDeleteForm.php b/src/Form/StaticNodeDeleteForm.php
index 4265800..65a4ffb 100644
--- a/src/Form/StaticNodeDeleteForm.php
+++ b/src/Form/StaticNodeDeleteForm.php
@@ -2,11 +2,11 @@
 
 namespace Drupal\static_node\Form;
 
+use Drupal\node\NodeInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\ConfirmFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Messenger\MessengerInterface;
-use Drupal\Core\Url;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\static_node\Service\StaticNodeHooks;
 use Drupal\Core\TempStore\PrivateTempStoreFactory;
@@ -74,7 +74,7 @@ class StaticNodeDeleteForm extends ConfirmFormBase {
     EntityTypeManagerInterface $entity_type_manager,
     MessengerInterface $messenger,
     StaticNodeHooks $static_node_hooks,
-    PrivateTempStoreFactory $temp_store_factory
+    PrivateTempStoreFactory $temp_store_factory,
   ) {
     $this->entityTypeManager = $entity_type_manager;
     $this->messenger = $messenger;
@@ -106,7 +106,7 @@ class StaticNodeDeleteForm extends ConfirmFormBase {
    */
   public function buildForm(array $form, FormStateInterface $form_state, $node = NULL) {
     // Fix: Accept either a Node object or a node ID.
-    if ($node instanceof \Drupal\node\NodeInterface) {
+    if ($node instanceof NodeInterface) {
       $this->nodeId = $node->id();
     }
     else {
@@ -139,18 +139,18 @@ class StaticNodeDeleteForm extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function getCancelUrl() {
-    // Check if we have a stored original destination to return to
+    // Check if we have a stored original destination to return to.
     $tempstore = $this->tempStore->get('static_node');
     $original_destination = $tempstore->get('original_destination_' . $this->node->id());
-    
+
     if ($original_destination) {
-      // Clear the stored value as we've used it
+      // Clear the stored value as we've used it.
       $tempstore->delete('original_destination_' . $this->node->id());
-      
+
       return $this->redirect('system.admin');
     }
-    
-    // Default to returning to the content listing
+
+    // Default to returning to the content listing.
     return $this->redirect('system.admin');
   }
 
@@ -173,10 +173,11 @@ class StaticNodeDeleteForm extends ConfirmFormBase {
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $form_state->set('node', $this->node);
-    
-    // Delete the static file
+
+    // Delete the static file.
     $this->staticNodeHooks->deleteStaticVersion($form, $form_state);
-    
+
     $form_state->setRedirectUrl($this->getCancelUrl());
   }
+
 }
diff --git a/src/Form/StaticNodeGenerateForm.php b/src/Form/StaticNodeGenerateForm.php
index 6fa04fa..3fbee7d 100644
--- a/src/Form/StaticNodeGenerateForm.php
+++ b/src/Form/StaticNodeGenerateForm.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\static_node\Form;
 
+use Drupal\node\NodeInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\ConfirmFormBase;
 use Drupal\Core\Form\FormStateInterface;
@@ -74,7 +75,7 @@ class StaticNodeGenerateForm extends ConfirmFormBase {
     EntityTypeManagerInterface $entity_type_manager,
     MessengerInterface $messenger,
     StaticNodeHooks $static_node_hooks,
-    PrivateTempStoreFactory $temp_store_factory
+    PrivateTempStoreFactory $temp_store_factory,
   ) {
     $this->entityTypeManager = $entity_type_manager;
     $this->messenger = $messenger;
@@ -106,7 +107,7 @@ class StaticNodeGenerateForm extends ConfirmFormBase {
    */
   public function buildForm(array $form, FormStateInterface $form_state, $node = NULL) {
     // Fix: Accept either a Node object or a node ID.
-    if ($node instanceof \Drupal\node\NodeInterface) {
+    if ($node instanceof NodeInterface) {
       $this->nodeId = $node->id();
     }
     else {
@@ -139,15 +140,15 @@ class StaticNodeGenerateForm extends ConfirmFormBase {
    * {@inheritdoc}
    */
   public function getCancelUrl() {
-    // Get the original destination from tempstore if available
+    // Get the original destination from tempstore if available.
     $tempstore = $this->tempStore->get('static_node');
     $original_destination = $tempstore->get('original_destination_' . $this->nodeId);
-    
+
     if ($original_destination) {
       $tempstore->delete('original_destination_' . $this->nodeId);
       return Url::fromUserInput('/' . $original_destination);
     }
-    
+
     return $this->node->toUrl();
   }
 
@@ -170,10 +171,11 @@ class StaticNodeGenerateForm extends ConfirmFormBase {
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $form_state->set('node', $this->node);
-    
-    // Generate the static file
+
+    // Generate the static file.
     $this->staticNodeHooks->generateStaticVersion($form, $form_state);
-    
+
     $form_state->setRedirectUrl($this->getCancelUrl());
   }
+
 }
diff --git a/src/Hook/StaticNodeHooks.php b/src/Hook/StaticNodeHooks.php
new file mode 100644
index 0000000..6066af0
--- /dev/null
+++ b/src/Hook/StaticNodeHooks.php
@@ -0,0 +1,185 @@
+<?php
+
+namespace Drupal\static_node\Hook;
+
+use Drupal\Core\Form\FormState;
+use Drupal\node\NodeInterface;
+use Drupal\Core\Url;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\node\NodeForm;
+use Drupal\Core\Entity\EntityForm;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Hook\Attribute\Hook;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+
+/**
+ * Hook implementations for static_node.
+ */
+class StaticNodeHooks {
+  use StringTranslationTrait;
+
+  /**
+   * Implements hook_help().
+   */
+  #[Hook('help')]
+  public function help(string $route_name, RouteMatchInterface $route_match): string {
+    switch ($route_name) {
+      case 'help.page.static_node':
+        $text = file_get_contents(dirname(__FILE__) . '/README.md');
+        if (!\Drupal::moduleHandler()->moduleExists('markdown')) {
+          \Drupal::messenger()->addMessage(new TranslatableMarkup('To view this page correctly, please install and enable the markdown module.'));
+          return '<pre>' . $text . '</pre>';
+        }
+        else {
+          // Use the Markdown filter to render the README.
+          $filter_manager = \Drupal::service('plugin.manager.filter');
+          $settings = \Drupal::configFactory()->get('markdown.settings')->getRawData();
+          $config = [
+            'settings' => $settings,
+          ];
+          $filter = $filter_manager->createInstance('markdown', $config);
+          return $filter->process($text, 'en');
+        }
+    }
+    return '';
+  }
+
+  /**
+   * Implements hook_form_alter().
+   */
+  #[Hook('form_alter')]
+  public function formAlter(array &$form, FormStateInterface $form_state, $form_id) {
+    $form_object = $form_state->getFormObject();
+    // Check if this is a node form.
+    if ($form_object instanceof EntityForm && $form_object instanceof NodeForm) {
+      // Get the static node service and call its form alter method.
+      $static_node_hooks = \Drupal::service('static_node.hooks');
+      if ($static_node_hooks) {
+        $static_node_hooks->formNodeFormAlter($form, $form_state, $form_id);
+      }
+    }
+    return $form;
+  }
+
+  /**
+   * Implements hook_preprocess().
+   */
+  #[Hook('preprocess')]
+  public function preprocess(&$variables, $hook) {
+    if ($hook == 'page' || $hook == 'node') {
+      $static_node_hooks = \Drupal::service('static_node.hooks');
+      if ($static_node_hooks) {
+        $static_node_hooks->preprocess($variables, $hook);
+      }
+    }
+  }
+
+  /**
+   * Implements hook_form_FORM_ID_alter().
+   *
+   * Add Static Page Generator to the site configuration form.
+   */
+  #[Hook('form_system_site_information_settings_alter')]
+  public function formSystemSiteInformationSettingsAlter(&$form, FormStateInterface $form_state, $form_id) {
+    if (\Drupal::currentUser()->hasPermission('generate static node')) {
+      $form['static_homepage'] = [
+        '#type' => 'details',
+        '#title' => $this->t('Static Homepage'),
+        '#description' => $this->t('Generate a static HTML version of the homepage to improve performance.'),
+        '#open' => TRUE,
+        '#weight' => 5,
+      ];
+      $form['static_homepage']['generate_static_homepage'] = [
+        '#type' => 'submit',
+        '#value' => $this->t('Generate Static Homepage'),
+        '#submit' => [
+          'static_node_generate_homepage',
+        ],
+        '#button_type' => 'primary',
+      ];
+      // Check if a static homepage already exists.
+      $static_node_hooks = \Drupal::service('static_node.hooks');
+      if ($static_node_hooks) {
+        $static_file = NULL;
+        if (method_exists($static_node_hooks, 'getHomepageStaticFile')) {
+          $static_file = $static_node_hooks->getHomepageStaticFile();
+        }
+        if ($static_file) {
+          $file_url = \Drupal::service('file_url_generator')->generateAbsoluteString($static_file->uri->value);
+          $form['static_homepage']['#description'] .= '<br>' . $this->t('Static HTML homepage URL:') . '<br><b>' . $file_url . '</b>';
+          $form['static_homepage']['delete_static_homepage'] = [
+            '#type' => 'submit',
+            '#value' => $this->t('Delete Static Homepage'),
+            '#submit' => [
+              'static_node_delete_homepage',
+            ],
+            '#button_type' => 'secondary',
+          ];
+        }
+      }
+    }
+  }
+
+  /**
+   * Implements hook_entity_operation().
+   */
+  #[Hook('entity_operation')]
+  public function entityOperation(EntityInterface $entity) {
+    $operations = [];
+    // Only add operations for nodes.
+    if ($entity->getEntityTypeId() !== 'node') {
+      return $operations;
+    }
+    // Check if user has permission to generate static nodes.
+    if (!\Drupal::currentUser()->hasPermission('generate static node')) {
+      return $operations;
+    }
+    // Check if this node type is enabled for static generation.
+    $enabled_types = \Drupal::config('static_node.settings')->get('node_types') ?: [];
+    if (!in_array($entity->bundle(), $enabled_types)) {
+      return $operations;
+    }
+    // Add operation to generate static page.
+    $operations['generate_static'] = [
+      'title' => $this->t('Generate Static Page'),
+      'url' => Url::fromRoute('static_node.generate_confirm', [
+        'node' => $entity->id(),
+      ]),
+      'weight' => 50,
+    ];
+    return $operations;
+  }
+
+  /**
+   * Implements hook_node_delete().
+   */
+  #[Hook('node_delete')]
+  public function nodeDelete(NodeInterface $node) {
+    // Check if purging is enabled.
+    if (!\Drupal::config('static_node.settings')->get('purge_missing')) {
+      return;
+    }
+    // Get the static node service.
+    $static_node_hooks = \Drupal::service('static_node.hooks');
+    if ($static_node_hooks) {
+      // Create a form state to pass to the delete method.
+      $form_state = new FormState();
+      $form_state->set('node', $node);
+      $static_node_hooks->deleteStaticVersion([], $form_state);
+    }
+  }
+
+  /**
+   * Implements hook_page_attachments().
+   */
+  #[Hook('page_attachments')]
+  public function pageAttachments(array &$page) {
+    // Attach our icons library when the toolbar is present.
+    if (\Drupal::service('module_handler')->moduleExists('toolbar')) {
+      $page['#attached']['library'][] = 'static_node/toolbar';
+    }
+  }
+
+}
diff --git a/src/Plugin/Action/DeleteStaticPageAction.php b/src/Plugin/Action/DeleteStaticPageAction.php
index 850c462..a4256ce 100644
--- a/src/Plugin/Action/DeleteStaticPageAction.php
+++ b/src/Plugin/Action/DeleteStaticPageAction.php
@@ -2,9 +2,9 @@
 
 namespace Drupal\static_node\Plugin\Action;
 
+use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Action\ActionBase;
-use Drupal\Core\Form\FormState;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
@@ -78,7 +78,7 @@ class DeleteStaticPageAction extends ActionBase implements ContainerFactoryPlugi
     StaticNodeHooks $static_node_hooks,
     PrivateTempStoreFactory $temp_store_factory,
     AccountInterface $current_user,
-    \Drupal\Core\Config\ConfigFactoryInterface $config_factory
+    ConfigFactoryInterface $config_factory,
   ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->staticNodeHooks = $static_node_hooks;
@@ -105,18 +105,18 @@ class DeleteStaticPageAction extends ActionBase implements ContainerFactoryPlugi
   /**
    * {@inheritdoc}
    */
-  public function access($node, AccountInterface $account = NULL, $return_as_object = FALSE) {
-    // Check basic node access
+  public function access($node, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
+    // Check basic node access.
     $access = $node->access('update', $account, TRUE);
-    
-    // Check if user has permission to delete static nodes
+
+    // Check if user has permission to delete static nodes.
     $permission_check = $account ? $account->hasPermission('delete static node') : $this->currentUser->hasPermission('delete static node');
-    
+
     // Check if this node type is enabled for static generation (if it's not enabled, it shouldn't be deleted either)
     $enabled_types = $this->configFactory->get('static_node.settings')->get('node_types') ?: [];
     $type_enabled = in_array($node->bundle(), $enabled_types);
-    
-    // Combine all access checks
+
+    // Combine all access checks.
     $access = $access->andIf(AccessResult::allowedIf($permission_check && $type_enabled));
 
     return $return_as_object ? $access : $access->isAllowed();
@@ -139,25 +139,25 @@ class DeleteStaticPageAction extends ActionBase implements ContainerFactoryPlugi
     foreach ($entities as $entity) {
       $info[$entity->id()] = $entity->id();
     }
-    
+
     // Store the node IDs in tempstore for the confirmation form.
     $this->tempStoreFactory
       ->get('static_node_bulk_delete')
       ->set($this->currentUser->id(), $info);
-      
-    // Store the current destination path in tempstore
+
+    // Store the current destination path in tempstore.
     $request = \Drupal::requestStack()->getCurrentRequest();
     if ($request->query->has('destination')) {
       $destination = $request->query->get('destination');
-      // Store it for retrieval in the confirmation form
+      // Store it for retrieval in the confirmation form.
       $this->tempStoreFactory
         ->get('static_node')
         ->set('bulk_delete_destination', $destination);
-      
-      // Remove it from the request to prevent immediate redirect
+
+      // Remove it from the request to prevent immediate redirect.
       $request->query->remove('destination');
     }
-      
+
     return [];
   }
 
diff --git a/src/Plugin/Action/GenerateStaticPageAction.php b/src/Plugin/Action/GenerateStaticPageAction.php
index 4daf3ca..a699540 100644
--- a/src/Plugin/Action/GenerateStaticPageAction.php
+++ b/src/Plugin/Action/GenerateStaticPageAction.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\static_node\Plugin\Action;
 
+use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Action\ActionBase;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -59,12 +60,12 @@ class GenerateStaticPageAction extends ActionBase implements ContainerFactoryPlu
    *   The config factory.
    */
   public function __construct(
-    array $configuration, 
-    $plugin_id, 
-    $plugin_definition, 
-    PrivateTempStoreFactory $temp_store_factory, 
+    array $configuration,
+    $plugin_id,
+    $plugin_definition,
+    PrivateTempStoreFactory $temp_store_factory,
     AccountInterface $current_user,
-    \Drupal\Core\Config\ConfigFactoryInterface $config_factory
+    ConfigFactoryInterface $config_factory,
   ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->tempStoreFactory = $temp_store_factory;
@@ -95,25 +96,25 @@ class GenerateStaticPageAction extends ActionBase implements ContainerFactoryPlu
     foreach ($entities as $entity) {
       $info[$entity->id()] = $entity->id();
     }
-    
+
     // Store the node IDs in tempstore for the confirmation form.
     $this->tempStoreFactory
       ->get('static_node_bulk_generate')
       ->set($this->currentUser->id(), $info);
-    
-    // Store the current destination path in tempstore
+
+    // Store the current destination path in tempstore.
     $request = \Drupal::request();
     if ($request->query->has('destination')) {
       $destination = $request->query->get('destination');
-      // Store it for retrieval in the confirmation form
+      // Store it for retrieval in the confirmation form.
       $this->tempStoreFactory
         ->get('static_node')
         ->set('bulk_destination', $destination);
-      
-      // Remove it from the request to prevent immediate redirect
+
+      // Remove it from the request to prevent immediate redirect.
       $request->query->remove('destination');
     }
-      
+
     return [];
   }
 
@@ -128,16 +129,17 @@ class GenerateStaticPageAction extends ActionBase implements ContainerFactoryPlu
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     /** @var \Drupal\node\NodeInterface $object */
     $result = $object->access('update', $account, TRUE);
-        
-    // Check if this node type is enabled for static generation
+
+    // Check if this node type is enabled for static generation.
     $enabled_types = $this->configFactory->get('static_node.settings')->get('node_types') ?: [];
     $type_enabled = in_array($object->bundle(), $enabled_types);
-    
+
     $result = $result->andIf(AccessResult::allowedIf($this->currentUser->hasPermission('generate static node') && $type_enabled));
-    
+
     return $return_as_object ? $result : $result->isAllowed();
   }
+
 }
diff --git a/src/Service/StaticNodeHooks.php b/src/Service/StaticNodeHooks.php
index dd7acc7..9803e9b 100644
--- a/src/Service/StaticNodeHooks.php
+++ b/src/Service/StaticNodeHooks.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\static_node\Service;
 
+use Drupal\Core\Entity\EntityFormInterface;
 use Drupal\Component\Serialization\Json;
 use Drupal\Core\Ajax\AjaxResponse;
 use Drupal\Core\Ajax\RedirectCommand;
@@ -38,7 +39,7 @@ use Drupal\Core\Url;
  */
 class StaticNodeHooks implements ContainerInjectionInterface {
   use StringTranslationTrait;
-  
+
   /**
    * The entity type manager.
    *
@@ -115,21 +116,21 @@ class StaticNodeHooks implements ContainerInjectionInterface {
    * @var \Symfony\Component\HttpFoundation\RequestStack
    */
   protected $requestStack;
-  
+
   /**
    * The file repository service.
    *
    * @var \Drupal\file\FileRepositoryInterface
    */
   protected $fileRepository;
-  
+
   /**
    * The messenger service.
    *
    * @var \Drupal\Core\Messenger\MessengerInterface
    */
   protected $messenger;
-  
+
   /**
    * The logger factory.
    *
@@ -203,7 +204,7 @@ class StaticNodeHooks implements ContainerInjectionInterface {
     MessengerInterface $messenger,
     LoggerChannelFactoryInterface $logger_factory,
     RouteMatchInterface $route_match,
-    PrivateTempStoreFactory $temp_store_factory
+    PrivateTempStoreFactory $temp_store_factory,
   ) {
     $this->entityTypeManager = $entity_type_manager;
     $this->pathAliasManager = $path_alias_manager;
@@ -260,28 +261,29 @@ class StaticNodeHooks implements ContainerInjectionInterface {
     if (!$nid) {
       return;
     }
-    
-    // Check if user has the permission to generate static nodes
+
+    // Check if user has the permission to generate static nodes.
     if (!$this->currentUser->hasPermission('generate static node')) {
       return;
     }
-    
-    // Check if this node type is enabled for static generation
+
+    // Check if this node type is enabled for static generation.
     $enabled_types = $this->configFactory->get('static_node.settings')->get('node_types') ?: [];
     if (!in_array($node->bundle(), $enabled_types)) {
       return;
     }
-    
+
     $alias = $this->pathAliasManager->getAliasByPath('/node/' . $nid);
     $locale = $this->languageManager->getCurrentLanguage()->getId();
 
-    // Place the form element directly in the main form rather than in a subgroup
+    // Place the form element directly in the main form rather than in a subgroup.
     $form['static_page'] = [
       '#type' => 'details',
       '#title' => $this->t('Static Page Generator'),
       '#description' => $this->t('Generate a static HTML file for this node and automatically redirect the page for improved performance.'),
       '#open' => TRUE,
-      '#group' => 'advanced',  // This connects it to the right sidebar
+    // This connects it to the right sidebar.
+      '#group' => 'advanced',
       '#attributes' => ['class' => ['generate-static-version-form']],
       '#weight' => -100,
     ];
@@ -290,7 +292,7 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       '#type' => 'container',
     ];
 
-    // Update the generate button to use a confirmation form
+    // Update the generate button to use a confirmation form.
     $form['static_page']['actions']['submit'] = [
       '#type' => 'link',
       '#title' => $this->t('Generate Static Page'),
@@ -312,16 +314,16 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       ],
     ];
 
-    // Check if a static file exists for this node
+    // Check if a static file exists for this node.
     $static_file = $this->findStaticFile($locale, $alias);
-    
+
     if ($static_file) {
       $file_url = $this->fileUrlGenerator->generateAbsoluteString($static_file->uri->value);
-      
+
       $this->messenger->deleteByType('warning');
       $this->messenger->addWarning($this->t('This node has static version configured'));
-      
-      // Only show delete button if user has delete permission
+
+      // Only show delete button if user has delete permission.
       if ($this->currentUser->hasPermission('delete static node')) {
         $form['static_page']['actions']['delete'] = [
           '#type' => 'link',
@@ -339,29 +341,30 @@ class StaticNodeHooks implements ContainerInjectionInterface {
           '#attached' => [
             'library' => [
               'core/drupal.dialog.ajax',
-              'core/drupal.dialog',],
+              'core/drupal.dialog',
+            ],
           ],
         ];
       }
-      
+
       $form['static_page']['actions']['submit']['#value'] = $this->t('Update Static Page');
       $form['static_page']['#open'] = TRUE;
-      
-      // Make sure there is a description before appending to it
+
+      // Make sure there is a description before appending to it.
       if (!isset($form['static_page']['#description'])) {
         $form['static_page']['#description'] = '';
       }
-      
+
       $form['static_page']['#description'] .= '<br>' . $this->t('Static HTML page URL:') . '<br><b>' . $file_url . '</b>';
     }
   }
-  
+
   /**
    * Submit handler to redirect to the confirmation form for static page generation.
    */
   public function generateStaticVersionConfirm(FormStateInterface $form_state) {
     $form_object = $form_state->getFormObject();
-    if (!$form_object instanceof \Drupal\Core\Entity\EntityFormInterface) {
+    if (!$form_object instanceof EntityFormInterface) {
       return;
     }
     $node = $form_object->getEntity();
@@ -369,28 +372,29 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       return;
     }
     $response = new AjaxResponse();
-    // Store the original destination in a session to be used after confirmation
+    // Store the original destination in a session to be used after confirmation.
     $request = $this->requestStack->getCurrentRequest();
     if ($request->query->has('destination')) {
       $original_destination = $request->query->get('destination');
       $request->query->remove('destination');
-      
-      // Store it in session for later use
+
+      // Store it in session for later use.
       $tempstore = $this->tempStoreFactory->get('static_node');
       $tempstore->set('original_destination_' . $node->id(), $original_destination);
-    } else {
-      // If no destination parameter, store the current path as the destination
+    }
+    else {
+      // If no destination parameter, store the current path as the destination.
       $current_path = $request->getPathInfo();
       if ($current_path && $current_path !== '/') {
         $tempstore = $this->tempStoreFactory->get('static_node');
         $tempstore->set('original_destination_' . $node->id(), ltrim($current_path, '/'));
       }
     }
-    
-    // Build the URL for the confirmation form
+
+    // Build the URL for the confirmation form.
     $url = Url::fromRoute('static_node.generate_confirm', ['node' => $node->id()]);
     Cache::invalidateTags($node->getCacheTags());
-    // Set the redirect without the problematic destination parameter
+    // Set the redirect without the problematic destination parameter.
     $response->addCommand(new RedirectCommand($url->toString()));
     $form_state->setResponse($response);
     return $response;
@@ -404,23 +408,23 @@ class StaticNodeHooks implements ContainerInjectionInterface {
     if (!$node instanceof Node || !$node->id()) {
       return;
     }
-    
-    // Store the original destination in a session to be used after confirmation
+
+    // Store the original destination in a session to be used after confirmation.
     $request = $this->requestStack->getCurrentRequest();
     if ($request->query->has('destination')) {
       $original_destination = $request->query->get('destination');
       $request->query->remove('destination');
-      
-      // Store it in session for later use
+
+      // Store it in session for later use.
       $tempstore = $this->tempStoreFactory->get('static_node');
       $tempstore->set('original_destination_' . $node->id(), $original_destination);
     }
-    
-    // Build the URL for the confirmation form
+
+    // Build the URL for the confirmation form.
     $url = Url::fromRoute('static_node.delete_confirm', ['node' => $node->id()]);
-    
+
     Cache::invalidateTags($node->getCacheTags());
-    // Set the redirect without the problematic destination parameter
+    // Set the redirect without the problematic destination parameter.
     $form_state->setRedirectUrl($url);
   }
 
@@ -429,17 +433,17 @@ class StaticNodeHooks implements ContainerInjectionInterface {
    */
   #[Hook('preprocess')]
   public function preprocess(&$variables, $hook) {
-    // Only process for node and page hooks
+    // Only process for node and page hooks.
     if ($hook !== 'node' && $hook !== 'page') {
       return;
     }
-    
+
     // Check if the user is authenticated (no redirect for authenticated users)
     if ($this->currentUser->isAuthenticated()) {
       return;
     }
-    
-    // Check if we already redirected to avoid endless loops
+
+    // Check if we already redirected to avoid endless loops.
     $redirected = &drupal_static('static_node_redirected', FALSE);
     if ($redirected) {
       return;
@@ -447,101 +451,101 @@ class StaticNodeHooks implements ContainerInjectionInterface {
 
     $current_request = $this->requestStack->getCurrentRequest();
     $current_path = $current_request->getPathInfo();
-    
-    // Special handling for homepage
+
+    // Special handling for homepage.
     if ($current_path === '/' || $this->pathMatcher->isFrontPage()) {
-      // Try to find the static version of the homepage
+      // Try to find the static version of the homepage.
       $static_file = $this->findHomepageStaticFile();
-      
+
       if ($static_file) {
         $file_url = $this->fileUrlGenerator->generateAbsoluteString($static_file->uri->value);
-        
-        // Mark as redirected to avoid endless loops
+
+        // Mark as redirected to avoid endless loops.
         $redirected = TRUE;
-        
-        // Redirect to the static file
+
+        // Redirect to the static file.
         $response = new RedirectResponse($file_url, 302);
         $response->send();
         exit;
       }
-      
-      // If no static homepage found, just return and let Drupal serve the dynamic page
+
+      // If no static homepage found, just return and let Drupal serve the dynamic page.
       return;
     }
-    
-    // For non-homepage content, try to get the node from different template variables
+
+    // For non-homepage content, try to get the node from different template variables.
     $node = NULL;
-    
+
     if (isset($variables['node']) && $variables['node'] instanceof EntityInterface) {
       $node = $variables['node'];
     }
     else {
-      // Try to get node from route context
+      // Try to get node from route context.
       $node = $this->routeMatch->getParameter('node');
     }
-    
-    // If we couldn't find a node, exit early
+
+    // If we couldn't find a node, exit early.
     if (!$node instanceof EntityInterface) {
       return;
     }
-    
+
     $nid = $node->id();
     $locale = $this->languageManager->getCurrentLanguage()->getId();
     $alias = $this->pathAliasManager->getAliasByPath('/node/' . $nid);
-    
+
     // NEW: Check if the current path actually matches the node's path
     // This prevents redirects meant for child pages (like /news/article-1) from affecting parent pages (like /news)
     $node_path = '/' . trim($alias, '/');
     if ($current_path !== $node_path) {
-      // The current path doesn't match the node's path exactly, so don't redirect
+      // The current path doesn't match the node's path exactly, so don't redirect.
       return;
     }
-    
-    // Try multiple methods to find the static file
+
+    // Try multiple methods to find the static file.
     $static_file = $this->findStaticFile($locale, $alias);
-    
+
     if (!$static_file) {
       return;
     }
-    
+
     $file_url = $this->fileUrlGenerator->generateAbsoluteString($static_file->uri->value);
-    
-    // Extract just the path from the file URL for comparison
+
+    // Extract just the path from the file URL for comparison.
     $file_url_parsed = parse_url($file_url);
     $file_path = $file_url_parsed['path'] ?? '';
-    
-    // Don't redirect if on admin pages
+
+    // Don't redirect if on admin pages.
     if (strpos($current_path, '/admin') === 0) {
       return;
     }
-    
-    // Compare the current URL path with the static file path
+
+    // Compare the current URL path with the static file path.
     $current_url = $current_request->getUri();
     $current_url_parsed = parse_url($current_url);
     $current_path = $current_url_parsed['path'] ?? '';
-    
-    // If we're already on the static file, don't redirect
+
+    // If we're already on the static file, don't redirect.
     if ($current_path === $file_path) {
       return;
     }
-    
-    // Check if this is a callback or AJAX request that shouldn't be redirected
+
+    // Check if this is a callback or AJAX request that shouldn't be redirected.
     if ($current_request->isXmlHttpRequest() || $current_request->query->has('_wrapper_format')) {
       return;
     }
-    
-    // Mark as redirected to avoid endless loops
+
+    // Mark as redirected to avoid endless loops.
     $redirected = TRUE;
-    
-    // Always invalidate cache for this node
+
+    // Always invalidate cache for this node.
     Cache::invalidateTags($node->getCacheTags());
-    
-    // Redirect to the static file
+
+    // Redirect to the static file.
     $response = new RedirectResponse($file_url, 302);
     $response->send();
     exit;
   }
-  
+
   /**
    * Find the static file for the homepage.
    *
@@ -552,26 +556,26 @@ class StaticNodeHooks implements ContainerInjectionInterface {
     $locale = $this->languageManager->getCurrentLanguage()->getId();
     $file_storage = $this->entityTypeManager->getStorage('file');
     $static_dir = $this->getStaticDirectory();
-    
-    // Check for common homepage patterns
+
+    // Check for common homepage patterns.
     $homepage_paths = [
       $static_dir . "/{$locale}/index.html",
       $static_dir . "/{$locale}/front.html",
       $static_dir . "/{$locale}/home.html",
       $static_dir . "/index.html",
-      $static_dir . "/front.html", 
+      $static_dir . "/front.html",
       $static_dir . "/home.html",
     ];
-    
-    // Get the node ID of the front page if available
+
+    // Get the node ID of the front page if available.
     try {
       $config = $this->configFactory->get('system.site');
       $front_page = $config->get('page.front');
-      
+
       if (preg_match('/node\/(\d+)/', $front_page, $matches)) {
         $front_nid = $matches[1];
         $alias = $this->pathAliasManager->getAliasByPath('/node/' . $front_nid);
-        
+
         if ($alias) {
           $homepage_paths[] = $static_dir . "/{$locale}{$alias}.html";
         }
@@ -582,23 +586,24 @@ class StaticNodeHooks implements ContainerInjectionInterface {
         '@error' => $e->getMessage(),
       ]);
     }
-    
-    // Try each potential homepage path
+
+    // Try each potential homepage path.
     foreach ($homepage_paths as $path) {
       $files = $file_storage->loadByProperties(['uri' => $path]);
       if (!empty($files)) {
         return reset($files);
       }
     }
-    
-    // Try a more generic approach with a query 
+
+    // Try a more generic approach with a query.
     try {
       $query = $file_storage->getQuery()
         ->condition('uri', $static_dir . '/%index%.html', 'LIKE')
-        ->accessCheck(FALSE)  // Explicitly disable access checking for system operation
+      // Explicitly disable access checking for system operation.
+        ->accessCheck(FALSE)
         ->range(0, 1);
       $fids = $query->execute();
-      
+
       if (!empty($fids)) {
         $files = $file_storage->loadMultiple($fids);
         return reset($files);
@@ -609,7 +614,7 @@ class StaticNodeHooks implements ContainerInjectionInterface {
         '@error' => $e->getMessage(),
       ]);
     }
-    
+
     return NULL;
   }
 
@@ -627,30 +632,30 @@ class StaticNodeHooks implements ContainerInjectionInterface {
    * Generates a static version of the homepage.
    */
   public function generateStaticHomepage(): void {
-    // Check if user has the permission to generate static nodes
+    // Check if user has the permission to generate static nodes.
     if (!$this->currentUser->hasPermission('generate static node')) {
       $this->messenger->addError($this->t('You do not have permission to generate static pages.'));
       return;
     }
-    
+
     $locale = $this->languageManager->getCurrentLanguage()->getId() ?: '';
     $file_path = $this->getStaticFilePath($locale, '/index', 'index.html');
     $file_directory = dirname($file_path);
-    
+
     if (!$this->fileSystem->prepareDirectory($file_directory, FileSystemInterface::CREATE_DIRECTORY)) {
       $this->messenger->addError($this->t('Unable to create directory.'));
       return;
     }
-    
-    // Clean up any existing file first
+
+    // Clean up any existing file first.
     $static_file = $this->findHomepageStaticFile();
     if ($static_file) {
       $static_file->delete();
     }
-    
+
     $options = [];
-    
-    // Handle Shield module if enabled
+
+    // Handle Shield module if enabled.
     if ($this->moduleHandler->moduleExists('shield')) {
       $shield_config = $this->configFactory->get('shield.settings');
       if ($shield_config && $shield_config->get('shield_enable')) {
@@ -666,41 +671,41 @@ class StaticNodeHooks implements ContainerInjectionInterface {
     // Get the base URL for the homepage (front page)
     $base_url = $this->requestStack->getCurrentRequest()->getSchemeAndHttpHost();
     $url = $base_url . "/";
-    
+
     try {
-      $options['verify'] = false;
+      $options['verify'] = FALSE;
       $response = $this->httpClient->request('GET', $url, $options);
 
       if ($response->getStatusCode() === 200) {
         $html = $response->getBody()->getContents();
 
-        // Load content into a DOM object
+        // Load content into a DOM object.
         $dom = new \DOMDocument();
-        // Suppress warnings for malformed HTML
+        // Suppress warnings for malformed HTML.
         @$dom->loadHTML($html);
 
-        // Process CSS files
+        // Process CSS files.
         $this->processCssFiles($dom, $base_url, $locale, '/index', $options);
-        
-        // Process script files
+
+        // Process script files.
         $this->processScriptFiles($dom, $base_url, $options);
-        
-        // Process JSON files
+
+        // Process JSON files.
         $this->processJsonFiles($dom, $base_url, $options);
-        
-        // Process favicons
+
+        // Process favicons.
         $this->processFavicons($dom, $base_url, $options);
-        
-        // Process all links to make them absolute
+
+        // Process all links to make them absolute.
         $this->processLinks($dom, $base_url);
-        
-        // Process buttons with onclick handlers
+
+        // Process buttons with onclick handlers.
         $this->processButtons($dom, $base_url);
 
         $updated_html = $dom->saveHTML();
 
         $file = $this->fileRepository->writeData($updated_html, $file_path, FileExists::Replace);
-        
+
         if ($file) {
           $this->messenger->addMessage($this->t('Static homepage generated successfully.'));
         }
@@ -711,24 +716,24 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       $this->loggerFactory->get('static_node')->error('Error generating static homepage: @message', ['@message' => $e->getMessage()]);
     }
   }
-  
+
   /**
    * Deletes the static version of the homepage.
    */
   public function deleteStaticHomepage(): void {
-    // Check if user has the permission to delete static nodes
+    // Check if user has the permission to delete static nodes.
     if (!$this->currentUser->hasPermission('delete static node')) {
       $this->messenger->addError($this->t('You do not have permission to delete static pages.'));
       return;
     }
-    
+
     $static_file = $this->findHomepageStaticFile();
-    
+
     if ($static_file) {
       $static_file->delete();
       $this->messenger->addStatus($this->t('Static homepage file deleted.'));
       Cache::invalidateTags(['config:system.site']);
-    } 
+    }
     else {
       $this->messenger->addStatus($this->t('No static homepage file found to delete.'));
     }
@@ -750,29 +755,30 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       $rel = strtolower($link->getAttribute('rel'));
       $as = strtolower($link->getAttribute('as'));
 
-      // CSS handling
+      // CSS handling.
       if ($rel === 'stylesheet') {
         $options['headers']['Accept'] = 'text/css,*/*;q=0.1';
         $css_url = $link->getAttribute('href');
-        
+
         if (strpos($css_url, '/sites/default') === 0 || strpos($css_url, '/themes/custom') === 0 || strpos($css_url, '/modules') === 0) {
           $css_url = $base_url . $css_url;
-        } else {
+        }
+        else {
           continue;
         }
 
         try {
           $css_response = $this->httpClient->request('GET', $css_url, $options);
           $css_content = $css_response->getBody()->getContents();
-        
-          // Update font references in CSS
+
+          // Update font references in CSS.
           $css_content = preg_replace_callback('/url\(([^)]+)\)/', function ($matches) use ($base_url) {
             $font_url = trim($matches[1], '"\'');
-            // If the font URL is relative, update it to the new path
+            // If the font URL is relative, update it to the new path.
             if (strpos($font_url, '/themes/custom') === 0 || strpos($font_url, '/modules') === 0) {
               $font_url = $base_url . $font_url;
             }
-            // Modify the font path
+            // Modify the font path.
             $new_font_url = $this->removeQueryString($font_url);
             return 'url(' . $new_font_url . ')';
           }, $css_content);
@@ -786,25 +792,27 @@ class StaticNodeHooks implements ContainerInjectionInterface {
           }
 
           $this->fileRepository->writeData($css_content, $css_file_path, FileExists::Replace);
-          // Update the link in the DOM
+          // Update the link in the DOM.
           $css_file_url = $this->fileUrlGenerator->generateAbsoluteString($css_file_path);
           $link->setAttribute('href', $this->removeQueryString($css_file_url));
-        } catch (\Exception $e) {
+        }
+        catch (\Exception $e) {
           $this->loggerFactory->get('static_node')->error('Error retrieving CSS: @url - @error', [
             '@url' => $css_url,
             '@error' => $e->getMessage(),
           ]);
         }
       }
-    
+
       // Font handling (preload)
       if ($rel === 'preload' && $as === 'font') {
         $options['headers']['Accept'] = 'font/woff2, font/woff, */*;q=0.1';
         $font_url = $link->getAttribute('href');
-    
+
         if (strpos($font_url, '/themes/custom') === 0 || strpos($font_url, '/modules') === 0) {
           $font_url = $base_url . $font_url;
-        } else {
+        }
+        else {
           continue;
         }
 
@@ -820,10 +828,11 @@ class StaticNodeHooks implements ContainerInjectionInterface {
           }
 
           $this->fileRepository->writeData($font_content, $font_file_path, FileExists::Replace);
-          // Update the link in the DOM with the absolute path of the font
+          // Update the link in the DOM with the absolute path of the font.
           $font_file_url = $this->fileUrlGenerator->generateAbsoluteString($font_file_path);
           $link->setAttribute('href', $this->removeQueryString($font_file_url));
-        } catch (\Exception $e) {
+        }
+        catch (\Exception $e) {
           $this->loggerFactory->get('static_node')->error('Error retrieving font: @url - @error', [
             '@url' => $font_url,
             '@error' => $e->getMessage(),
@@ -838,16 +847,17 @@ class StaticNodeHooks implements ContainerInjectionInterface {
    */
   protected function processScriptFiles(\DOMDocument $dom, string $base_url, array $options): void {
     $scripts = $dom->getElementsByTagName('script');
-    
+
     foreach ($scripts as $script) {
       $options['headers']['Accept'] = 'application/javascript, text/javascript, */*;q=0.1';
       if ($script && $script->getAttribute('src')) {
         $js_url = $script->getAttribute('src');
-        
+
         if (strpos($js_url, '/sites/default') === 0 || strpos($js_url, '/themes/custom') === 0 || strpos($js_url, '/modules') === 0) {
           // Fix: Use string concatenation operator (.) instead of addition (+)
           $js_url = $base_url . $js_url;
-        } else {
+        }
+        else {
           continue;
         }
 
@@ -862,7 +872,7 @@ class StaticNodeHooks implements ContainerInjectionInterface {
             return;
           }
 
-          // Analyze JS content to find internal resource references
+          // Analyze JS content to find internal resource references.
           preg_match_all('/["\'](\/modules\/[^"\']+)["\']/', $js_content, $matches);
           foreach ($matches[1] as $resource_url) {
             $full_resource_url = $base_url . $resource_url;
@@ -880,10 +890,11 @@ class StaticNodeHooks implements ContainerInjectionInterface {
               }
 
               $this->fileRepository->writeData($resource_content, $resource_file_path, FileExists::Replace);
-              // Update references in JavaScript
+              // Update references in JavaScript.
               $local_resource_url = $this->fileUrlGenerator->generateAbsoluteString($resource_file_path);
               $js_content = str_replace($resource_url, $this->removeQueryString($local_resource_url), $js_content);
-            } catch (\Exception $e) {
+            }
+            catch (\Exception $e) {
               $this->loggerFactory->get('static_node')->error('Error retrieving JS resource: @url - @error', [
                 '@url' => $full_resource_url,
                 '@error' => $e->getMessage(),
@@ -891,12 +902,13 @@ class StaticNodeHooks implements ContainerInjectionInterface {
             }
           }
 
-          // Save the updated JavaScript file
+          // Save the updated JavaScript file.
           $this->fileRepository->writeData($js_content, $js_file_path, FileExists::Replace);
-          // Update the link in the DOM
+          // Update the link in the DOM.
           $js_file_url = $this->fileUrlGenerator->generateAbsoluteString($js_file_path);
           $script->setAttribute('src', $this->removeQueryString($js_file_url));
-        } catch (\Exception $e) {
+        }
+        catch (\Exception $e) {
           $this->loggerFactory->get('static_node')->error('Error retrieving JS: @url - @error', [
             '@url' => $js_url,
             '@error' => $e->getMessage(),
@@ -918,7 +930,8 @@ class StaticNodeHooks implements ContainerInjectionInterface {
 
         if (strpos($json_url, '/sites/default') === 0) {
           $json_url = $base_url . $json_url;
-        } else {
+        }
+        else {
           continue;
         }
 
@@ -926,7 +939,7 @@ class StaticNodeHooks implements ContainerInjectionInterface {
           $json_response = $this->httpClient->request('GET', $json_url, $options);
           $json_content = $json_response->getBody()->getContents();
           $json_file_path = "public://static/json/" . basename($json_url);
-          
+
           $json_directory = dirname($json_file_path);
           if (!$this->fileSystem->prepareDirectory($json_directory, FileSystemInterface::CREATE_DIRECTORY)) {
             $this->messenger->addError($this->t('Unable to create directory for JSON files.'));
@@ -936,7 +949,8 @@ class StaticNodeHooks implements ContainerInjectionInterface {
           $this->fileRepository->writeData($json_content, $json_file_path, FileExists::Replace);
           $json_file_url = $this->fileUrlGenerator->generateAbsoluteString($json_file_path);
           $script->setAttribute('src', $this->removeQueryString($json_file_url));
-        } catch (\Exception $e) {
+        }
+        catch (\Exception $e) {
           $this->loggerFactory->get('static_node')->error('Error retrieving JSON: @url - @error', [
             '@url' => $json_url,
             '@error' => $e->getMessage(),
@@ -959,7 +973,8 @@ class StaticNodeHooks implements ContainerInjectionInterface {
         if (strpos($favicon_url, '/sites/default') === 0) {
           // Fix: Use string concatenation operator (.) instead of addition (+)
           $favicon_url = $base_url . $favicon_url;
-        } else {
+        }
+        else {
           continue;
         }
 
@@ -967,7 +982,7 @@ class StaticNodeHooks implements ContainerInjectionInterface {
           $favicon_response = $this->httpClient->request('GET', $favicon_url, $options);
           $favicon_content = $favicon_response->getBody()->getContents();
           $favicon_file_path = "public://static/" . basename($favicon_url);
-          
+
           $favicon_directory = dirname($favicon_file_path);
           if (!$this->fileSystem->prepareDirectory($favicon_directory, FileSystemInterface::CREATE_DIRECTORY)) {
             $this->messenger->addError($this->t('Unable to create directory for favicons.'));
@@ -978,7 +993,8 @@ class StaticNodeHooks implements ContainerInjectionInterface {
 
           $favicon_file_url = $this->fileUrlGenerator->generateAbsoluteString($favicon_file_path);
           $favicon->setAttribute('href', $this->removeQueryString($favicon_file_url));
-        } catch (\Exception $e) {
+        }
+        catch (\Exception $e) {
           $this->loggerFactory->get('static_node')->error('Error retrieving favicon: @url - @error', [
             '@url' => $favicon_url,
             '@error' => $e->getMessage(),
@@ -999,7 +1015,7 @@ class StaticNodeHooks implements ContainerInjectionInterface {
 
       // Check if the URL is relative (starts with "/")
       if (strncmp($href, '/', 1) === 0 && strncmp($href, '//', 2) !== 0) {
-        // Build the absolute path by concatenating $base_url with the relative path
+        // Build the absolute path by concatenating $base_url with the relative path.
         $absolute_url = $base_url . $href;
         $link->setAttribute('href', str_replace('/s3fs-public/' . $this->getStaticDirectoryName(), '', $absolute_url));
       }
@@ -1014,34 +1030,34 @@ class StaticNodeHooks implements ContainerInjectionInterface {
     foreach ($buttons as $button) {
       $onclick = $button->getAttribute('onclick');
 
-      // If the onclick attribute contains a relative URL, modify the URL
-      if (strpos($onclick, "redirectToUrl('") !== false) {
-        // Find the URL inside the redirectToUrl() function
+      // If the onclick attribute contains a relative URL, modify the URL.
+      if (strpos($onclick, "redirectToUrl('") !== FALSE) {
+        // Find the URL inside the redirectToUrl() function.
         if (preg_match("/redirectToUrl\('([^']+)'\)/", $onclick, $matches)) {
           $relative_url = $matches[1];
 
-          // Check if the URL is relative
+          // Check if the URL is relative.
           if (strncmp($relative_url, '/', 1) === 0 && strncmp($relative_url, '//', 2) !== 0) {
-            // Create the absolute path
+            // Create the absolute path.
             $absolute_url = $base_url . $relative_url;
-            // Replace the relative URL with the absolute URL
+            // Replace the relative URL with the absolute URL.
             $onclick = str_replace($relative_url, $absolute_url, $onclick);
             $button->setAttribute('onclick', str_replace('/s3fs-public/' . $this->getStaticDirectoryName(), '', $onclick));
           }
         }
       }
 
-      // Handle the case: onclick="window.location.href = 'en/livigno'"
-      if (strpos($onclick, "window.location.href = '") !== false) {
-        // Find the URL inside the window.location.href function
+      // Handle the case: onclick="window.location.href = 'en/livigno'".
+      if (strpos($onclick, "window.location.href = '") !== FALSE) {
+        // Find the URL inside the window.location.href function.
         if (preg_match("/window.location.href = '([^']+)'/", $onclick, $matches)) {
           $relative_url = $matches[1];
 
-          // Check if the URL is relative
+          // Check if the URL is relative.
           if (strncmp($relative_url, '/', 1) === 0 && strncmp($relative_url, '//', 2) !== 0) {
-            // Create the absolute path
+            // Create the absolute path.
             $absolute_url = $base_url . $relative_url;
-            // Replace the relative URL with the absolute URL
+            // Replace the relative URL with the absolute URL.
             $onclick = str_replace($relative_url, $absolute_url, $onclick);
             $button->setAttribute('onclick', str_replace('/s3fs-public/' . $this->getStaticDirectoryName(), '', $onclick));
           }
@@ -1090,7 +1106,7 @@ class StaticNodeHooks implements ContainerInjectionInterface {
     }
     return $static_dir . '/' . $locale . $alias . '.html';
   }
-  
+
   /**
    * Find a static file for a given path.
    *
@@ -1104,24 +1120,24 @@ class StaticNodeHooks implements ContainerInjectionInterface {
    */
   protected function findStaticFile(string $locale, string $alias) {
     $file_storage = $this->entityTypeManager->getStorage('file');
-    
+
     // 1. Try exact path match first
     $file_path = $this->getStaticFilePath($locale, $alias);
     $files = $file_storage->loadByProperties(['uri' => $file_path]);
     if (!empty($files)) {
       return reset($files);
     }
-    
+
     // 2. Try by filename for the homepage.
     $file_name = str_replace('/', '', $alias) . '.html';
     $files = $file_storage->loadByProperties(['filename' => $file_name]);
     if (!empty($files)) {
       return reset($files);
     }
-    
+
     // 3. Try with a SQL LIKE query
     try {
-      // Use LIKE query to find files with URI containing the path segment
+      // Use LIKE query to find files with URI containing the path segment.
       $query = $file_storage->getQuery()
         ->condition('uri', '%' . $alias . '.html', 'LIKE')
         ->accessCheck(FALSE);
@@ -1129,12 +1145,12 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       if (!empty($fids)) {
         $files = $file_storage->loadMultiple($fids);
         foreach ($files as $file) {
-          // Check if the file URI contains the locale
+          // Check if the file URI contains the locale.
           if (strpos($file->getFileUri(), "/{$locale}/") !== FALSE) {
             return $file;
           }
         }
-        // If no file with locale found, just return the first one
+        // If no file with locale found, just return the first one.
         return reset($files);
       }
     }
@@ -1143,10 +1159,10 @@ class StaticNodeHooks implements ContainerInjectionInterface {
         '@error' => $e->getMessage(),
       ]);
     }
-    
+
     return NULL;
   }
-  
+
   /**
    * Ensure the field_static_node entity reference field exists on File entity.
    */
@@ -1191,58 +1207,58 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       $config->save();
     }
   }
-  
+
   /**
    * Handles Static Page generation.
-   * 
+   *
    * @param array $form
    *   The form array.
    * @param \Drupal\Core\Form\FormStateInterface $form_state
    *   The form state object.
    */
   public function generateStaticVersion(array &$form, FormStateInterface $form_state) {
-    // Check if user has the permission to generate static nodes
+    // Check if user has the permission to generate static nodes.
     if (!$this->currentUser->hasPermission('generate static node')) {
       $this->messenger->addError($this->t('You do not have permission to generate static pages.'));
       return;
     }
-    
+
     // Try to get node from form state directly (for bulk actions)
     $node = $form_state->get('node');
     // If not found, try to get from form object (for normal form submission)
     if (!$node instanceof Node && $form_state->getFormObject()) {
       $node = $form_state->getFormObject()->getEntity();
     }
-    
+
     if (!$node instanceof Node) {
       $this->messenger->addError($this->t('Invalid node type.'));
       return;
     }
-    
+
     $nid = $node->id();
     if (!$nid) {
       $this->messenger->addError($this->t('Node not found.'));
       return;
     }
-    
+
     $locale = $this->languageManager->getCurrentLanguage()->getId() ?: '';
     $alias = $this->pathAliasManager->getAliasByPath('/node/' . $nid);
     $file_path = $this->getStaticFilePath($locale, $alias);
     $file_directory = dirname($file_path);
-    
+
     if (!$this->fileSystem->prepareDirectory($file_directory, FileSystemInterface::CREATE_DIRECTORY)) {
       $this->messenger->addError($this->t('Unable to create directory.'));
       return;
     }
-    
+
     $file_name = str_replace('/', '', $alias) . '.html';
     $target_file = $this->entityTypeManager->getStorage('file')
       ->loadByProperties(['filename' => $file_name]);
-    
+
     if ($file = reset($target_file)) {
       $file->delete();
     }
-    
+
     $options = [];
     if ($this->moduleHandler->moduleExists('shield')) {
       $shield_config = $this->configFactory->get('shield.settings');
@@ -1255,63 +1271,64 @@ class StaticNodeHooks implements ContainerInjectionInterface {
         }
       }
     }
-    
+
     if ($locale && !empty($locale)) {
       $url = Url::fromRoute('entity.node.canonical', ['node' => $nid], [
         'absolute' => TRUE,
-        'language' => $this->languageManager->getCurrentLanguage()
+        'language' => $this->languageManager->getCurrentLanguage(),
       ])->toString();
-    } else {
+    }
+    else {
       $url = Url::fromRoute('entity.node.canonical', ['node' => $nid], [
-        'absolute' => TRUE
+        'absolute' => TRUE,
       ])->toString();
     }
-    
+
     try {
-      $options['verify'] = false;
-      // Allow redirects for handling homepage and path aliases properly
-      $options['allow_redirects'] = true;
-      
+      $options['verify'] = FALSE;
+      // Allow redirects for handling homepage and path aliases properly.
+      $options['allow_redirects'] = TRUE;
+
       $this->loggerFactory->get('static_node')->notice('Fetching URL for static generation: @url', ['@url' => $url]);
       $response = $this->httpClient->request('GET', $url, $options);
 
       if ($response->getStatusCode() === 200) {
         $html = $response->getBody()->getContents();
 
-        // Extract base URL from the original URL
+        // Extract base URL from the original URL.
         $parsed_url = parse_url($url);
         $base_url = $parsed_url['scheme'] . '://' . $parsed_url['host'];
         if (isset($parsed_url['port'])) {
           $base_url .= ':' . $parsed_url['port'];
         }
 
-        // Load content into a DOM object
+        // Load content into a DOM object.
         $dom = new \DOMDocument();
-        // Suppress warnings for malformed HTML
+        // Suppress warnings for malformed HTML.
         @$dom->loadHTML($html);
 
-        // Process CSS files
+        // Process CSS files.
         $this->processCssFiles($dom, $base_url, $locale, $alias, $options);
-        
-        // Process script files
+
+        // Process script files.
         $this->processScriptFiles($dom, $base_url, $options);
-        
-        // Process JSON files
+
+        // Process JSON files.
         $this->processJsonFiles($dom, $base_url, $options);
-        
-        // Process favicons
+
+        // Process favicons.
         $this->processFavicons($dom, $base_url, $options);
-        
-        // Process all links to make them absolute
+
+        // Process all links to make them absolute.
         $this->processLinks($dom, $base_url);
-        
-        // Process buttons with onclick handlers
+
+        // Process buttons with onclick handlers.
         $this->processButtons($dom, $base_url);
 
         $updated_html = $dom->saveHTML();
-    
+
         $file = $this->fileRepository->writeData($updated_html, $file_path, FileExists::Replace);
-        // Relate static file to node
+        // Relate static file to node.
         $this->ensureStaticNodeFieldOnFile();
         if ($file && $file->hasField('field_static_node')) {
           $file->set('field_static_node', $nid);
@@ -1322,7 +1339,8 @@ class StaticNodeHooks implements ContainerInjectionInterface {
           $this->loggerFactory->get('static_node')->notice('Static page successfully generated for path: @path', ['@path' => $alias]);
           return $file;
         }
-      } else {
+      }
+      else {
         $this->messenger->addError($this->t('Error generating static page: HTTP status code @code', ['@code' => $response->getStatusCode()]));
         $this->loggerFactory->get('static_node')->error('Error generating static page: HTTP status code @code for URL @url', [
           '@code' => $response->getStatusCode(),
@@ -1341,82 +1359,82 @@ class StaticNodeHooks implements ContainerInjectionInterface {
 
   /**
    * Handles Static Page deletion.
-   * 
+   *
    * @param array $form
    *   The form array.
    * @param \Drupal\Core\Form\FormStateInterface $form_state
    *   The form state object.
    */
   public function deleteStaticVersion(array &$form, FormStateInterface $form_state): void {
-    // Check if user has the permission to delete static nodes
+    // Check if user has the permission to delete static nodes.
     if (!$this->currentUser->hasPermission('delete static node')) {
       $this->messenger->addError($this->t('You do not have permission to delete static pages.'));
       return;
     }
-    
+
     // Try to get node from form state directly (for bulk actions)
     $node = $form_state->get('node');
     // If not found, try to get from form object (for normal form submission)
     if (!$node instanceof Node && $form_state->getFormObject()) {
       $node = $form_state->getFormObject()->getEntity();
     }
-    
+
     if (!$node instanceof Node) {
       $this->messenger->addError($this->t('Invalid node type.'));
       return;
     }
-    
+
     $nid = $node->id();
     $locale = $this->languageManager->getCurrentLanguage()->getId() ?: '';
     $alias = $this->pathAliasManager->getAliasByPath('/node/' . $nid);
-    
-    // Find and delete the static file
+
+    // Find and delete the static file.
     $static_file = $this->findStaticFile($locale, $alias);
     if ($static_file) {
       $static_file->delete();
       $this->messenger->addStatus($this->t('Static Page file deleted.'));
-    } 
+    }
     else {
       $this->messenger->addStatus($this->t('No Static Page file found to delete.'));
     }
   }
 
   /**
-   * Generate static version for custom pages like Views
-   * 
+   * Generate static version for custom pages like Views.
+   *
    * @param string $path
    *   The path to generate a static version for.
    */
   public function generateStaticPageForPath(string $path): void {
-    // Check if user has the permission to generate static nodes
+    // Check if user has the permission to generate static nodes.
     if (!$this->currentUser->hasPermission('generate static node')) {
       $this->messenger->addError($this->t('You do not have permission to generate static pages.'));
       return;
     }
-    
+
     $locale = $this->languageManager->getCurrentLanguage()->getId() ?: '';
     $alias = $path;
     if ($alias[0] !== '/') {
       $alias = '/' . $alias;
     }
-    
+
     $file_path = $this->getStaticFilePath($locale, $alias);
     $file_directory = dirname($file_path);
-    
+
     if (!$this->fileSystem->prepareDirectory($file_directory, FileSystemInterface::CREATE_DIRECTORY)) {
       $this->messenger->addError($this->t('Unable to create directory.'));
       return;
     }
-    
-    // Delete any existing file first
+
+    // Delete any existing file first.
     $static_file = $this->findStaticFile($locale, $alias);
     if ($static_file) {
       $static_file->delete();
     }
-    
+
     $options = [];
-    
-    // Handle Shield module if enabled
+
+    // Handle Shield module if enabled.
     if ($this->moduleHandler->moduleExists('shield')) {
       $shield_config = $this->configFactory->get('shield.settings');
       if ($shield_config && $shield_config->get('shield_enable')) {
@@ -1429,44 +1447,44 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       }
     }
 
-    // Get the base URL for the page
+    // Get the base URL for the page.
     $base_url = $this->requestStack->getCurrentRequest()->getSchemeAndHttpHost();
     $url = $base_url . $alias;
-    
+
     try {
-      $options['verify'] = false;
+      $options['verify'] = FALSE;
       $response = $this->httpClient->request('GET', $url, $options);
 
       if ($response->getStatusCode() === 200) {
         $html = $response->getBody()->getContents();
 
-        // Load content into a DOM object
+        // Load content into a DOM object.
         $dom = new \DOMDocument();
-        // Suppress warnings for malformed HTML
+        // Suppress warnings for malformed HTML.
         @$dom->loadHTML($html);
 
-        // Process CSS files
+        // Process CSS files.
         $this->processCssFiles($dom, $base_url, $locale, $alias, $options);
-        
-        // Process script files
+
+        // Process script files.
         $this->processScriptFiles($dom, $base_url, $options);
-        
-        // Process JSON files
+
+        // Process JSON files.
         $this->processJsonFiles($dom, $base_url, $options);
-        
-        // Process favicons
+
+        // Process favicons.
         $this->processFavicons($dom, $base_url, $options);
-        
-        // Process all links to make them absolute
+
+        // Process all links to make them absolute.
         $this->processLinks($dom, $base_url);
-        
-        // Process buttons with onclick handlers
+
+        // Process buttons with onclick handlers.
         $this->processButtons($dom, $base_url);
 
         $updated_html = $dom->saveHTML();
 
         $file = $this->fileRepository->writeData($updated_html, $file_path, FileExists::Replace);
-        
+
         if ($file) {
           $this->messenger->addMessage($this->t('Static page for path @path generated successfully.', ['@path' => $alias]));
         }
@@ -1476,14 +1494,14 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       $this->messenger->addError($this->t('Error generating static page: @message', ['@message' => $e->getMessage()]));
       $this->loggerFactory->get('static_node')->error('Error generating static page for path @path: @message', [
         '@path' => $alias,
-        '@message' => $e->getMessage()
+        '@message' => $e->getMessage(),
       ]);
     }
   }
 
   /**
    * Handles Static Page generation from bulk actions.
-   * 
+   *
    * @param array $form
    *   The form array.
    * @param \Drupal\Core\Form\FormStateInterface $form_state
@@ -1496,25 +1514,27 @@ class StaticNodeHooks implements ContainerInjectionInterface {
       $this->messenger->addWarning($this->t('No items selected for generating static pages.'));
       return;
     }
-    
+
     $processed = 0;
-    
+
     foreach ($entities as $entity) {
       if ($entity instanceof Node) {
-        // Set the node in the form state for use by generateStaticVersion
+        // Set the node in the form state for use by generateStaticVersion.
         $form_state->set('node', $entity);
-        
-        // Generate the static version
+
+        // Generate the static version.
         $this->generateStaticVersion($form, $form_state);
-        
+
         $processed++;
       }
     }
-    
+
     if ($processed > 0) {
       $this->messenger->addStatus($this->t('Generated @count static pages successfully.', ['@count' => $processed]));
-    } else {
+    }
+    else {
       $this->messenger->addWarning($this->t('No valid nodes found for generating static pages.'));
     }
   }
+
 }
diff --git a/static_node.install b/static_node.install
index 64e6681..b982496 100644
--- a/static_node.install
+++ b/static_node.install
@@ -5,11 +5,12 @@
  * Install, update and uninstall functions for the Static Node module.
  */
 
+use Drupal\Component\Utility\DeprecationHelper;
+use Drupal\Core\Extension\Requirement\RequirementSeverity;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Messenger\MessengerInterface;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\Core\File\FileSystemInterface;
-use Drupal\Core\Database\Database;
 use Drupal\Core\Config\ConfigFactoryInterface;
 
 /**
@@ -21,10 +22,10 @@ function static_node_install() {
   $messenger = \Drupal::messenger();
   $config_factory = \Drupal::configFactory();
   $file_system = \Drupal::service('file_system');
-  
+
   // Create the action configurations.
   _static_node_create_actions($entity_type_manager, $messenger);
-  
+
   // Create the static directory if it doesn't exist.
   $static_dir = _static_node_get_static_directory($config_factory);
   try {
@@ -50,13 +51,14 @@ function static_node_uninstall() {
   $config_factory = \Drupal::configFactory();
 
   try {
-    // Get the configured static directory with fallback
+    // Get the configured static directory with fallback.
     $static_dir_name = _static_node_get_static_directory_name($config_factory);
-    
+
     // 1. Find all static files in the file_managed table
     $query = $file_storage->getQuery()
       ->condition('uri', '%' . $static_dir_name . '%', 'LIKE')
-      ->accessCheck(FALSE); // Explicitly disable access checks for system operation
+    // Explicitly disable access checks for system operation.
+      ->accessCheck(FALSE);
 
     $fids = $query->execute();
 
@@ -72,7 +74,7 @@ function static_node_uninstall() {
 
     // 3. Process each file
     foreach ($files as $file) {
-      // Get the directory to clean up later
+      // Get the directory to clean up later.
       $directory = dirname($file->getFileUri());
       if (!in_array($directory, $directories_to_clean)) {
         $directories_to_clean[] = $directory;
@@ -86,8 +88,9 @@ function static_node_uninstall() {
     foreach ($directories_to_clean as $directory) {
       if (file_exists($directory) && is_dir($directory)) {
         try {
-          // Remove directory if empty
-          if (count(scandir($directory)) <= 2) { // . and .. are always present
+          // Remove directory if empty.
+          // . and .. are always present.
+          if (count(scandir($directory)) <= 2) {
             $file_system->rmdir($directory);
           }
         }
@@ -136,10 +139,10 @@ function static_node_uninstall() {
 function _static_node_create_actions(EntityTypeManagerInterface $entity_type_manager, MessengerInterface $messenger) {
   // Load the action storage.
   $storage = $entity_type_manager->getStorage('action');
-  
-  // Check if actions already exist before creating them
+
+  // Check if actions already exist before creating them.
   $actions_created = FALSE;
-  
+
   // Create the "Generate static page" action if it doesn't exist.
   $generate_action = $storage->load('static_node_generate_action');
   if (!$generate_action) {
@@ -181,7 +184,7 @@ function _static_node_create_actions(EntityTypeManagerInterface $entity_type_man
     $delete_action->save();
     $actions_created = TRUE;
   }
-  
+
   if ($actions_created) {
     $messenger->addStatus(new TranslatableMarkup('Static Node bulk actions have been created.'));
   }
@@ -198,13 +201,13 @@ function _static_node_create_actions(EntityTypeManagerInterface $entity_type_man
 function _static_node_delete_actions(EntityTypeManagerInterface $entity_type_manager, MessengerInterface $messenger) {
   // Load the action storage.
   $storage = $entity_type_manager->getStorage('action');
-  
+
   // Delete the actions when uninstalling the module.
   $actions = $storage->loadMultiple([
     'static_node_generate_action',
     'static_node_delete_action',
   ]);
-  
+
   if (!empty($actions)) {
     $storage->delete($actions);
     $messenger->addStatus(new TranslatableMarkup('Static Node bulk actions have been removed.'));
@@ -241,7 +244,7 @@ function _static_node_get_static_directory(ConfigFactoryInterface $config_factor
  * Implements hook_schema().
  */
 function static_node_schema() {
-  // No database tables needed for this module
+  // No database tables needed for this module.
   return [];
 }
 
@@ -252,11 +255,11 @@ function static_node_requirements($phase) {
   $requirements = [];
 
   if ($phase == 'runtime') {
-    // Get all necessary services
+    // Get all necessary services.
     $config_factory = \Drupal::configFactory();
     $file_system = \Drupal::service('file_system');
-    
-    // Check if static directory is writable
+
+    // Check if static directory is writable.
     $static_directory = _static_node_get_static_directory($config_factory);
 
     if (!file_exists($static_directory)) {
@@ -267,29 +270,28 @@ function static_node_requirements($phase) {
         $requirements['static_node_directory'] = [
           'title' => t('Static Node directory'),
           'description' => t('The Static Node module needs to create a directory at @path but was unable to do so. Please check permissions.', ['@path' => $static_directory]),
-          'severity' => REQUIREMENT_ERROR,
+          'severity' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.2.0', fn() => RequirementSeverity::Error, fn() => REQUIREMENT_ERROR),
         ];
         return $requirements;
       }
     }
 
-    // Check if directory is writable
+    // Check if directory is writable.
     if (!is_writable($static_directory)) {
       $requirements['static_node_directory'] = [
         'title' => t('Static Node directory'),
         'description' => t('The Static Node directory (@path) is not writable. Please check permissions.', ['@path' => $static_directory]),
-        'severity' => REQUIREMENT_ERROR,
+        'severity' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.2.0', fn() => RequirementSeverity::Error, fn() => REQUIREMENT_ERROR),
       ];
     }
     else {
       $requirements['static_node_directory'] = [
         'title' => t('Static Node directory'),
         'description' => t('The Static Node directory (@path) is writable.', ['@path' => $static_directory]),
-        'severity' => REQUIREMENT_OK,
+        'severity' => DeprecationHelper::backwardsCompatibleCall(\Drupal::VERSION, '11.2.0', fn() => RequirementSeverity::OK, fn() => REQUIREMENT_OK),
       ];
     }
   }
 
   return $requirements;
 }
-
diff --git a/static_node.module b/static_node.module
index 1d457fd..27d84cb 100644
--- a/static_node.module
+++ b/static_node.module
@@ -5,41 +5,25 @@
  * Contains static_node module functionality.
  */
 
+use Drupal\Core\Hook\Attribute\LegacyHook;
+use Drupal\static_node\Hook\StaticNodeHooks;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
-use Drupal\Core\Entity\EntityForm;
-use Drupal\node\NodeForm;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\node\NodeInterface;
-use Drupal\Core\Form\FormState;
-use Drupal\Core\Url;
 
 /**
  * Implements hook_help().
  */
+#[LegacyHook]
 function static_node_help(string $route_name, RouteMatchInterface $route_match): string {
-  switch ($route_name) {
-    case 'help.page.static_node':
-      $text = file_get_contents(dirname(__FILE__) . '/README.md');
-      if (!\Drupal::moduleHandler()->moduleExists('markdown')) {
-        \Drupal::messenger()->addMessage(new TranslatableMarkup('To view this page correctly, please install and enable the markdown module.'));
-        return '<pre>' . $text . '</pre>';
-      } else {
-        // Use the Markdown filter to render the README.
-        $filter_manager = \Drupal::service('plugin.manager.filter');
-        $settings = \Drupal::configFactory()->get('markdown.settings')->getRawData();
-        $config = ['settings' => $settings];
-        $filter = $filter_manager->createInstance('markdown', $config);
-        return $filter->process($text, 'en');
-      }
-  }
-  return '';
+  return \Drupal::service(StaticNodeHooks::class)->help($route_name, $route_match);
 }
 
 /**
  * Compatibility function for static page generation.
- * 
+ *
  * This is a wrapper around the service method to maintain backward compatibility.
  */
 function static_node_generate_static_version(array &$form, FormStateInterface $form_state): void {
@@ -54,7 +38,7 @@ function static_node_generate_static_version(array &$form, FormStateInterface $f
 
 /**
  * Compatibility function for static page deletion.
- * 
+ *
  * This is a wrapper around the service method to maintain backward compatibility.
  */
 function static_node_delete_static_version(array &$form, FormStateInterface $form_state): void {
@@ -70,76 +54,27 @@ function static_node_delete_static_version(array &$form, FormStateInterface $for
 /**
  * Implements hook_form_alter().
  */
+#[LegacyHook]
 function static_node_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
-  $form_object = $form_state->getFormObject();
-  // Check if this is a node form
-  if ($form_object instanceof EntityForm && $form_object instanceof NodeForm) {
-    // Get the static node service and call its form alter method
-    $static_node_hooks = \Drupal::service('static_node.hooks');
-    if ($static_node_hooks) {
-      $static_node_hooks->formNodeFormAlter($form, $form_state, $form_id);
-    }
-  }
-  return $form;
+  return \Drupal::service(StaticNodeHooks::class)->formAlter($form, $form_state, $form_id);
 }
 
 /**
  * Implements hook_preprocess().
  */
+#[LegacyHook]
 function static_node_preprocess(&$variables, $hook) {
-  if ($hook == 'page' || $hook == 'node') {
-    $static_node_hooks = \Drupal::service('static_node.hooks');
-    if ($static_node_hooks) {
-      $static_node_hooks->preprocess($variables, $hook);
-    }
-  }
+  \Drupal::service(StaticNodeHooks::class)->preprocess($variables, $hook);
 }
 
 /**
  * Implements hook_form_FORM_ID_alter().
- * 
+ *
  * Add Static Page Generator to the site configuration form.
  */
+#[LegacyHook]
 function static_node_form_system_site_information_settings_alter(&$form, FormStateInterface $form_state, $form_id) {
-  if (\Drupal::currentUser()->hasPermission('generate static node')) {
-    $form['static_homepage'] = [
-      '#type' => 'details',
-      '#title' => t('Static Homepage'),
-      '#description' => t('Generate a static HTML version of the homepage to improve performance.'),
-      '#open' => TRUE,
-      '#weight' => 5,
-    ];
-    
-    $form['static_homepage']['generate_static_homepage'] = [
-      '#type' => 'submit',
-      '#value' => t('Generate Static Homepage'),
-      '#submit' => ['static_node_generate_homepage'],
-      '#button_type' => 'primary',
-    ];
-    
-    // Check if a static homepage already exists
-    $static_node_hooks = \Drupal::service('static_node.hooks');
-    if ($static_node_hooks) {
-      $static_file = NULL;
-      
-      if (method_exists($static_node_hooks, 'getHomepageStaticFile')) {
-        $static_file = $static_node_hooks->getHomepageStaticFile();
-      }
-      
-      if ($static_file) {
-        $file_url = \Drupal::service('file_url_generator')->generateAbsoluteString($static_file->uri->value);
-        
-        $form['static_homepage']['#description'] .= '<br>' . t('Static HTML homepage URL:') . '<br><b>' . $file_url . '</b>';
-        
-        $form['static_homepage']['delete_static_homepage'] = [
-          '#type' => 'submit',
-          '#value' => t('Delete Static Homepage'),
-          '#submit' => ['static_node_delete_homepage'],
-          '#button_type' => 'secondary',
-        ];
-      }
-    }
-  }
+  \Drupal::service(StaticNodeHooks::class)->formSystemSiteInformationSettingsAlter($form, $form_state, $form_id);
 }
 
 /**
@@ -171,60 +106,23 @@ function static_node_delete_homepage(array &$form, FormStateInterface $form_stat
 /**
  * Implements hook_entity_operation().
  */
+#[LegacyHook]
 function static_node_entity_operation(EntityInterface $entity) {
-  $operations = [];
-  
-  // Only add operations for nodes
-  if ($entity->getEntityTypeId() !== 'node') {
-    return $operations;
-  }
-  
-  // Check if user has permission to generate static nodes
-  if (!\Drupal::currentUser()->hasPermission('generate static node')) {
-    return $operations;
-  }
-  
-  // Check if this node type is enabled for static generation
-  $enabled_types = \Drupal::config('static_node.settings')->get('node_types') ?: [];
-  if (!in_array($entity->bundle(), $enabled_types)) {
-    return $operations;
-  }
-  
-  // Add operation to generate static page
-  $operations['generate_static'] = [
-    'title' => t('Generate Static Page'),
-    'url' => Url::fromRoute('static_node.generate_confirm', ['node' => $entity->id()]),
-    'weight' => 50,
-  ];
-  
-  return $operations;
+  return \Drupal::service(StaticNodeHooks::class)->entityOperation($entity);
 }
 
 /**
  * Implements hook_node_delete().
  */
+#[LegacyHook]
 function static_node_node_delete(NodeInterface $node) {
-  // Check if purging is enabled
-  if (!\Drupal::config('static_node.settings')->get('purge_missing')) {
-    return;
-  }
-  
-  // Get the static node service
-  $static_node_hooks = \Drupal::service('static_node.hooks');
-  if ($static_node_hooks) {
-    // Create a form state to pass to the delete method
-    $form_state = new FormState();
-    $form_state->set('node', $node);
-    $static_node_hooks->deleteStaticVersion([], $form_state);
-  }
+  \Drupal::service(StaticNodeHooks::class)->nodeDelete($node);
 }
 
 /**
  * Implements hook_page_attachments().
  */
+#[LegacyHook]
 function static_node_page_attachments(array &$page) {
-  // Attach our icons library when the toolbar is present
-  if (\Drupal::service('module_handler')->moduleExists('toolbar')) {
-    $page['#attached']['library'][] = 'static_node/toolbar';
-  }
+  \Drupal::service(StaticNodeHooks::class)->pageAttachments($page);
 }
diff --git a/static_node.services.yml b/static_node.services.yml
index 2992195..9323b6b 100644
--- a/static_node.services.yml
+++ b/static_node.services.yml
@@ -18,3 +18,7 @@ services:
       - '@logger.factory'
       - '@current_route_match'
       - '@tempstore.private'
+
+  Drupal\static_node\Hook\StaticNodeHooks:
+    class: Drupal\static_node\Hook\StaticNodeHooks
+    autowire: true
