From 0f219467a0848244c8aa32e25dc1b816a9680bcb Mon Sep 17 00:00:00 2001 From: Chaitanya Dessai <57453-chaitanyadessai@users.noreply.drupalcode.org> Date: Mon, 3 Jun 2024 12:38:26 +0530 Subject: [PATCH] D10 fix. --- notify_entity.info.yml | 3 +-- notify_entity.module | 9 +++++---- src/Form/NotifyEntityForm.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/notify_entity.info.yml b/notify_entity.info.yml index c28a979..358dc07 100644 --- a/notify_entity.info.yml +++ b/notify_entity.info.yml @@ -1,6 +1,5 @@ name: Notify Entity type: module description: 'Simple module to allow email notification for entity insert, update and delete.' +core_version_requirement: ^10 -version: '8.x-0.1' -core: '8.x' diff --git a/notify_entity.module b/notify_entity.module index 645ee2b..9bc91b6 100644 --- a/notify_entity.module +++ b/notify_entity.module @@ -2,10 +2,11 @@ +use Drupal\Core\Entity\EntityInterface; /** * Implements hook_entity_insert(). */ -function notify_entity_entity_insert(Drupal\Core\Entity\EntityInterface $entity) { +function notify_entity_entity_insert(EntityInterface $entity) { _notify_entity_trigger_event('insert', $entity); } @@ -13,7 +14,7 @@ function notify_entity_entity_insert(Drupal\Core\Entity\EntityInterface $entity) /** * Implements hook_entity_delete(). */ -function notify_entity_entity_delete(Drupal\Core\Entity\EntityInterface $entity) { +function notify_entity_entity_delete(EntityInterface $entity) { _notify_entity_trigger_event('delete', $entity); } @@ -21,7 +22,7 @@ function notify_entity_entity_delete(Drupal\Core\Entity\EntityInterface $entity) /** * Implements hook_entity_update(). */ -function notify_entity_entity_update(Drupal\Core\Entity\EntityInterface $entity) { +function notify_entity_entity_update(EntityInterface $entity) { _notify_entity_trigger_event('update', $entity); } @@ -32,7 +33,7 @@ function notify_entity_entity_update(Drupal\Core\Entity\EntityInterface $entity) * @param String $event A string to represent the event. * @param \Drupal\Core\Entity\EntityInterface $entity The triggering entity. */ -function _notify_entity_trigger_event($event, Drupal\Core\Entity\EntityInterface $entity) { +function _notify_entity_trigger_event($event, EntityInterface $entity) { $config = \Drupal::configFactory()->get('notify_entity.settings'); $key = _notify_entity_make_key($entity->getEntityTypeId(), $entity->bundle()); diff --git a/src/Form/NotifyEntityForm.php b/src/Form/NotifyEntityForm.php index 16fbca6..a02c8cc 100644 --- a/src/Form/NotifyEntityForm.php +++ b/src/Form/NotifyEntityForm.php @@ -32,7 +32,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['#tree'] = TRUE; - $entities = \Drupal::entityManager()->getAllBundleInfo(); + $entities = \Drupal::service('entity_type.bundle.info')->getAllBundleInfo(); foreach ($entities as $entity_type => $bundles) { foreach ($bundles as $bundle_type => $bundle_info) { $form['settings'][$entity_type][$bundle_type] = $this->formCreateRow(