From 52e8f9aca7cdd9c6eb670ff365629f6011558657 Mon Sep 17 00:00:00 2001
From: Owen Bush <ojb@ukhhf.co.uk>
Date: Wed, 15 May 2019 16:13:27 -0600
Subject: [PATCH] Fixed registrant delete form with dependency injection

---
 .../src/Form/RegistrantDeleteForm.php             | 15 ++++++++++++++-
 .../FieldInheritancePluginBase.php                |  1 -
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules/recurring_events_registration/src/Form/RegistrantDeleteForm.php b/modules/recurring_events_registration/src/Form/RegistrantDeleteForm.php
index 311fbc0c..a09abc25 100644
--- a/modules/recurring_events_registration/src/Form/RegistrantDeleteForm.php
+++ b/modules/recurring_events_registration/src/Form/RegistrantDeleteForm.php
@@ -3,6 +3,9 @@
 namespace Drupal\recurring_events_registration\Form;
 
 use Drupal\Core\Entity\ContentEntityDeleteForm;
+use Drupal\Core\Entity\EntityRepositoryInterface;
+use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
+use Drupal\Component\Datetime\TimeInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Url;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -25,10 +28,17 @@ class RegistrantDeleteForm extends ContentEntityDeleteForm {
   /**
    * Constructs a RegistrantDeleteForm object.
    *
+   * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
+   *   The entity repository service.
+   * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
+   *   The entity type bundle service.
+   * @param \Drupal\Component\Datetime\TimeInterface $time
+   *   The time service.
    * @param \Drupal\Core\Messenger\Messenger $messenger
    *   The messenger service.
    */
-  public function __construct(Messenger $messenger) {
+  public function __construct(EntityRepositoryInterface $entity_repository, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL, Messenger $messenger) {
+    parent::__construct($entity_repository, $entity_type_bundle_info, $time);
     $this->messenger = $messenger;
   }
 
@@ -37,6 +47,9 @@ class RegistrantDeleteForm extends ContentEntityDeleteForm {
    */
   public static function create(ContainerInterface $container) {
     return new static(
+      $container->get('entity.repository'),
+      $container->get('entity_type.bundle.info'),
+      $container->get('datetime.time'),
       $container->get('messenger')
     );
   }
diff --git a/src/Plugin/FieldInheritance/FieldInheritancePluginBase.php b/src/Plugin/FieldInheritance/FieldInheritancePluginBase.php
index b347656d..b7373880 100644
--- a/src/Plugin/FieldInheritance/FieldInheritancePluginBase.php
+++ b/src/Plugin/FieldInheritance/FieldInheritancePluginBase.php
@@ -7,7 +7,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\recurring_events\FieldInheritancePluginInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Drupal\Core\Entity\EntityInterface;
 
 /**
  * Abstract class FieldInheritancePluginBase.
-- 
GitLab