Skip to content
Snippets Groups Projects
Commit 52e8f9ac authored by Owen Bush's avatar Owen Bush
Browse files

Fixed registrant delete form with dependency injection

parent eb4636bb
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
namespace Drupal\recurring_events_registration\Form; namespace Drupal\recurring_events_registration\Form;
use Drupal\Core\Entity\ContentEntityDeleteForm; 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\Form\FormStateInterface;
use Drupal\Core\Url; use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
...@@ -25,10 +28,17 @@ class RegistrantDeleteForm extends ContentEntityDeleteForm { ...@@ -25,10 +28,17 @@ class RegistrantDeleteForm extends ContentEntityDeleteForm {
/** /**
* Constructs a RegistrantDeleteForm object. * 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 * @param \Drupal\Core\Messenger\Messenger $messenger
* The messenger service. * 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; $this->messenger = $messenger;
} }
...@@ -37,6 +47,9 @@ class RegistrantDeleteForm extends ContentEntityDeleteForm { ...@@ -37,6 +47,9 @@ class RegistrantDeleteForm extends ContentEntityDeleteForm {
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('entity.repository'),
$container->get('entity_type.bundle.info'),
$container->get('datetime.time'),
$container->get('messenger') $container->get('messenger')
); );
} }
......
...@@ -7,7 +7,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -7,7 +7,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\recurring_events\FieldInheritancePluginInterface; use Drupal\recurring_events\FieldInheritancePluginInterface;
use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Entity\EntityInterface;
/** /**
* Abstract class FieldInheritancePluginBase. * Abstract class FieldInheritancePluginBase.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment