diff --git a/fieldblock.info.yml b/fieldblock.info.yml
index 84ff3cbcb8a60b620e7a8c8e5ac267d303c0028b..db8950d06a2b70ca5c4fd7980c23fbc55d1d84cb 100644
--- a/fieldblock.info.yml
+++ b/fieldblock.info.yml
@@ -2,6 +2,7 @@ name: Field as Block
 description: 'Display fields of the current entity as blocks.'
 type: module
 core: 8.x
+core_version_requirement: ^8 || ^9
 dependencies:
   - drupal:block
 configure: fieldblock.field_block_config_form
diff --git a/src/Form/FieldBlockConfigForm.php b/src/Form/FieldBlockConfigForm.php
index 93c5d79cbddc9e3954808277c4050fc28d4a59e2..013bd1c466b31cdb85f243d7b4c649a01c13aa8a 100644
--- a/src/Form/FieldBlockConfigForm.php
+++ b/src/Form/FieldBlockConfigForm.php
@@ -176,7 +176,7 @@ class FieldBlockConfigForm extends ConfigFormBase {
           // Find and delete the remaining blocks for this entity type.
           $this->storage->deleteBlocksForEntityType($entity_type);
           $clear_cache = TRUE;
-          drupal_set_message($this->t('Remaining field blocks for the %type entity have been deleted.', ['%type' => $entity_type]));
+          $this->messenger()->addStatus($this->t('Remaining field blocks for the %type entity have been deleted.', ['%type' => $entity_type]));
         }
         else {
           if (in_array($entity_type, $this->getAllEntityTypes())) {