Loading examples/ExampleFormEventSubscribers.php +2 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\hook_event_dispatcher; 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\core_event_dispatcher\FormHookEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** Loading Loading @@ -63,7 +64,7 @@ class ExampleFormEventSubscribers implements EventSubscriberInterface { */ public static function getSubscribedEvents(): array { return [ HookEventDispatcherInterface::FORM_ALTER => 'alterForm', FormHookEvents::FORM_ALTER => 'alterForm', // React on "search_block_form" form. 'hook_event_dispatcher.form_search_block_form.alter' => 'alterSearchForm', // React on al forms with base id "node_form". Loading examples/ExampleTokenEventSubscriber.php +3 −2 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\hook_event_dispatcher; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\core_event_dispatcher\Event\Token\TokensInfoEvent; use Drupal\core_event_dispatcher\Event\Token\TokensReplacementEvent; use Drupal\core_event_dispatcher\TokenHookEvents; use Drupal\core_event_dispatcher\ValueObject\Token; use Drupal\core_event_dispatcher\ValueObject\TokenType; use Symfony\Component\EventDispatcher\EventSubscriberInterface; Loading @@ -28,8 +29,8 @@ final class ExampleTokenEventSubscriber implements EventSubscriberInterface { */ public static function getSubscribedEvents(): array { return [ HookEventDispatcherInterface::TOKEN_REPLACEMENT => 'tokenReplacement', HookEventDispatcherInterface::TOKEN_INFO => 'tokenInfo', TokenHookEvents::TOKEN_REPLACEMENT => 'tokenReplacement', TokenHookEvents::TOKEN_INFO => 'tokenInfo', ]; } Loading modules/core_event_dispatcher/src/Event/Form/FormAlterEvent.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\core_event_dispatcher\Event\Form; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\core_event_dispatcher\FormHookEvents; /** * Class FormAlterEvent. Loading @@ -13,7 +13,7 @@ class FormAlterEvent extends AbstractFormEvent { * {@inheritdoc} */ public function getDispatcherType(): string { return HookEventDispatcherInterface::FORM_ALTER; return FormHookEvents::FORM_ALTER; } } modules/core_event_dispatcher/src/Event/Language/LanguageSwitchLinksAlterEvent.php +5 −3 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ namespace Drupal\core_event_dispatcher\Event\Language; use Drupal\Component\EventDispatcher\Event; use Drupal\Core\Url; use Drupal\core_event_dispatcher\LanguageHookEvents; use Drupal\hook_event_dispatcher\Event\EventInterface; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\Component\EventDispatcher\Event; /** * Class LanguageSwitchLinksAlterEvent. Loading @@ -18,12 +18,14 @@ class LanguageSwitchLinksAlterEvent extends Event implements EventInterface { * @var array */ private $links; /** * The language type. * * @var string */ private $type; /** * The request path. * Loading Loading @@ -93,7 +95,7 @@ class LanguageSwitchLinksAlterEvent extends Event implements EventInterface { * {@inheritdoc} */ public function getDispatcherType(): string { return HookEventDispatcherInterface::LANGUAGE_SWITCH_LINKS_ALTER; return LanguageHookEvents::LANGUAGE_SWITCH_LINKS_ALTER; } } modules/core_event_dispatcher/src/Event/Theme/PageAttachmentsEvent.php +3 −3 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ namespace Drupal\core_event_dispatcher\Event\Theme; use Drupal\hook_event_dispatcher\Event\EventInterface; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\Component\EventDispatcher\Event; use Drupal\core_event_dispatcher\PageHookEvents; use Drupal\hook_event_dispatcher\Event\EventInterface; /** * Class PageAttachmentsEvent. Loading Loading @@ -42,7 +42,7 @@ class PageAttachmentsEvent extends Event implements EventInterface { * {@inheritdoc} */ public function getDispatcherType(): string { return HookEventDispatcherInterface::PAGE_ATTACHMENTS; return PageHookEvents::PAGE_ATTACHMENTS; } } Loading
examples/ExampleFormEventSubscribers.php +2 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\hook_event_dispatcher; 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\core_event_dispatcher\FormHookEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** Loading Loading @@ -63,7 +64,7 @@ class ExampleFormEventSubscribers implements EventSubscriberInterface { */ public static function getSubscribedEvents(): array { return [ HookEventDispatcherInterface::FORM_ALTER => 'alterForm', FormHookEvents::FORM_ALTER => 'alterForm', // React on "search_block_form" form. 'hook_event_dispatcher.form_search_block_form.alter' => 'alterSearchForm', // React on al forms with base id "node_form". Loading
examples/ExampleTokenEventSubscriber.php +3 −2 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\hook_event_dispatcher; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\core_event_dispatcher\Event\Token\TokensInfoEvent; use Drupal\core_event_dispatcher\Event\Token\TokensReplacementEvent; use Drupal\core_event_dispatcher\TokenHookEvents; use Drupal\core_event_dispatcher\ValueObject\Token; use Drupal\core_event_dispatcher\ValueObject\TokenType; use Symfony\Component\EventDispatcher\EventSubscriberInterface; Loading @@ -28,8 +29,8 @@ final class ExampleTokenEventSubscriber implements EventSubscriberInterface { */ public static function getSubscribedEvents(): array { return [ HookEventDispatcherInterface::TOKEN_REPLACEMENT => 'tokenReplacement', HookEventDispatcherInterface::TOKEN_INFO => 'tokenInfo', TokenHookEvents::TOKEN_REPLACEMENT => 'tokenReplacement', TokenHookEvents::TOKEN_INFO => 'tokenInfo', ]; } Loading
modules/core_event_dispatcher/src/Event/Form/FormAlterEvent.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\core_event_dispatcher\Event\Form; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\core_event_dispatcher\FormHookEvents; /** * Class FormAlterEvent. Loading @@ -13,7 +13,7 @@ class FormAlterEvent extends AbstractFormEvent { * {@inheritdoc} */ public function getDispatcherType(): string { return HookEventDispatcherInterface::FORM_ALTER; return FormHookEvents::FORM_ALTER; } }
modules/core_event_dispatcher/src/Event/Language/LanguageSwitchLinksAlterEvent.php +5 −3 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ namespace Drupal\core_event_dispatcher\Event\Language; use Drupal\Component\EventDispatcher\Event; use Drupal\Core\Url; use Drupal\core_event_dispatcher\LanguageHookEvents; use Drupal\hook_event_dispatcher\Event\EventInterface; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\Component\EventDispatcher\Event; /** * Class LanguageSwitchLinksAlterEvent. Loading @@ -18,12 +18,14 @@ class LanguageSwitchLinksAlterEvent extends Event implements EventInterface { * @var array */ private $links; /** * The language type. * * @var string */ private $type; /** * The request path. * Loading Loading @@ -93,7 +95,7 @@ class LanguageSwitchLinksAlterEvent extends Event implements EventInterface { * {@inheritdoc} */ public function getDispatcherType(): string { return HookEventDispatcherInterface::LANGUAGE_SWITCH_LINKS_ALTER; return LanguageHookEvents::LANGUAGE_SWITCH_LINKS_ALTER; } }
modules/core_event_dispatcher/src/Event/Theme/PageAttachmentsEvent.php +3 −3 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ namespace Drupal\core_event_dispatcher\Event\Theme; use Drupal\hook_event_dispatcher\Event\EventInterface; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\Component\EventDispatcher\Event; use Drupal\core_event_dispatcher\PageHookEvents; use Drupal\hook_event_dispatcher\Event\EventInterface; /** * Class PageAttachmentsEvent. Loading Loading @@ -42,7 +42,7 @@ class PageAttachmentsEvent extends Event implements EventInterface { * {@inheritdoc} */ public function getDispatcherType(): string { return HookEventDispatcherInterface::PAGE_ATTACHMENTS; return PageHookEvents::PAGE_ATTACHMENTS; } }