Skip to content
Snippets Groups Projects
Commit 8b9698ed authored by Eric Bremner's avatar Eric Bremner
Browse files

Updating code to use hook_event_dispatcher 2.x branch

parent 4cc27be1
No related branches found
Tags 2.0.0-rc1
No related merge requests found
...@@ -4,4 +4,4 @@ type: module ...@@ -4,4 +4,4 @@ type: module
core_version_requirement: ^8.8 || ^9 core_version_requirement: ^8.8 || ^9
dependencies: dependencies:
- drupal:layout_builder - drupal:layout_builder
- hook_event_dispatcher - hook_event_dispatcher:core_event_dispatcher
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
namespace Drupal\layout_builder_ids\EventSubscriber; namespace Drupal\layout_builder_ids\EventSubscriber;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\hook_event_dispatcher\Event\Form\FormAlterEvent; use Drupal\core_event_dispatcher\Event\Form\FormAlterEvent;
use Drupal\core_event_dispatcher\Event\Form\FormBaseAlterEvent;
use Drupal\core_event_dispatcher\Event\Form\FormIdAlterEvent;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Html;
...@@ -16,10 +18,10 @@ class LayoutBuilderIdsConfigureBlock implements EventSubscriberInterface { ...@@ -16,10 +18,10 @@ class LayoutBuilderIdsConfigureBlock implements EventSubscriberInterface {
/** /**
* Alter form. * Alter form.
* *
* @param \Drupal\hook_event_dispatcher\Event\Form\FormAlterEvent $event * @param \Drupal\core_event_dispatcher\Event\Form\FormAlterEvent $event
* The event. * The event.
*/ */
public function alterForm(FormAlterEvent $event) { public function alterForm(FormAlterEvent $event): void {
// Get the form from the event. // Get the form from the event.
$form = &$event->getForm(); $form = &$event->getForm();
...@@ -67,7 +69,8 @@ class LayoutBuilderIdsConfigureBlock implements EventSubscriberInterface { ...@@ -67,7 +69,8 @@ class LayoutBuilderIdsConfigureBlock implements EventSubscriberInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function getSubscribedEvents() { public static function getSubscribedEvents(): array {
return [ return [
HookEventDispatcherInterface::FORM_ALTER => 'alterForm', HookEventDispatcherInterface::FORM_ALTER => 'alterForm',
]; ];
......
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
namespace Drupal\layout_builder_ids\EventSubscriber; namespace Drupal\layout_builder_ids\EventSubscriber;
use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormStateInterface;
use Drupal\hook_event_dispatcher\Event\Form\FormAlterEvent; use Drupal\core_event_dispatcher\Event\Form\FormAlterEvent;
use Drupal\core_event_dispatcher\Event\Form\FormBaseAlterEvent;
use Drupal\core_event_dispatcher\Event\Form\FormIdAlterEvent;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Routing\RouteCollection;
use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Html;
...@@ -18,10 +19,10 @@ class LayoutBuilderIdsConfigureSection implements EventSubscriberInterface { ...@@ -18,10 +19,10 @@ class LayoutBuilderIdsConfigureSection implements EventSubscriberInterface {
/** /**
* Alter form. * Alter form.
* *
* @param \Drupal\hook_event_dispatcher\Event\Form\FormAlterEvent $event * @param \Drupal\core_event_dispatcher\Event\Form\FormAlterEvent $event
* The event. * The event.
*/ */
public function alterForm(FormAlterEvent $event) { public function alterForm(FormAlterEvent $event): void {
// Get the form from the event. // Get the form from the event.
$form = &$event->getForm(); $form = &$event->getForm();
......
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