Loading modules/path_event_dispatcher/src/Event/Path/PathDeleteEvent.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\path_event_dispatcher\Event\Path; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\path_event_dispatcher\PathHookEvents; /** * Class PathDeleteEvent. Loading @@ -26,7 +26,7 @@ final class PathDeleteEvent extends AbstractPathEvent { * The dispatcher type. */ public function getDispatcherType(): string { return HookEventDispatcherInterface::PATH_DELETE; return PathHookEvents::PATH_DELETE; } } modules/path_event_dispatcher/src/Event/Path/PathInsertEvent.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\path_event_dispatcher\Event\Path; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\path_event_dispatcher\PathHookEvents; /** * Class PathInsertEvent. Loading @@ -16,7 +16,7 @@ final class PathInsertEvent extends AbstractPathEvent { * The dispatcher type. */ public function getDispatcherType(): string { return HookEventDispatcherInterface::PATH_INSERT; return PathHookEvents::PATH_INSERT; } } modules/path_event_dispatcher/src/Event/Path/PathUpdateEvent.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\path_event_dispatcher\Event\Path; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\path_event_dispatcher\PathHookEvents; /** * Class UpdatePathEvent. Loading @@ -16,7 +16,7 @@ final class PathUpdateEvent extends AbstractPathEvent { * The dispatcher type. */ public function getDispatcherType(): string { return HookEventDispatcherInterface::PATH_UPDATE; return PathHookEvents::PATH_UPDATE; } } modules/path_event_dispatcher/src/PathHookEvents.php 0 → 100644 +48 −0 Original line number Diff line number Diff line <?php namespace Drupal\path_event_dispatcher; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; /** * Defines events for path hooks. */ final class PathHookEvents { /** * Respond to a path being inserted. * * @Event * * @see \Drupal\path_event_dispatcher\Event\Path\PathInsertEvent * @see path_event_dispatcher_path_alias_insert() * * @var string */ public const PATH_INSERT = HookEventDispatcherInterface::PREFIX . 'path.insert'; /** * Respond to a path being updated. * * @Event * * @see \Drupal\path_event_dispatcher\Event\Path\PathUpdateEvent * @see path_event_dispatcher_path_alias_update() * * @var string */ public const PATH_UPDATE = HookEventDispatcherInterface::PREFIX . 'path.update'; /** * Respond to a path being deleted. * * @Event * * @see \Drupal\path_event_dispatcher\Event\Path\PathDeleteEvent * @see path_event_dispatcher_path_alias_delete() * * @var string */ public const PATH_DELETE = HookEventDispatcherInterface::PREFIX . 'path.delete'; } modules/path_event_dispatcher/tests/src/Kernel/PathEventTest.php +7 −7 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ namespace Drupal\Tests\path_event_dispatcher\Kernel; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\KernelTests\KernelTestBase; use Drupal\path_event_dispatcher\Event\Path\PathDeleteEvent; use Drupal\path_event_dispatcher\Event\Path\PathInsertEvent; use Drupal\path_event_dispatcher\Event\Path\PathUpdateEvent; use Drupal\path_event_dispatcher\PathHookEvents; use Drupal\Tests\hook_event_dispatcher\Kernel\ListenerTrait; /** Loading Loading @@ -60,9 +60,9 @@ class PathEventTest extends KernelTestBase { * @throws \Exception */ public function testPathInsertEvent(): void { $this->listen(HookEventDispatcherInterface::PATH_INSERT, 'onPathInsert'); $this->listen(HookEventDispatcherInterface::PATH_UPDATE, 'onPathUpdate'); $this->listen(HookEventDispatcherInterface::PATH_DELETE, 'onPathDelete'); $this->listen(PathHookEvents::PATH_INSERT, 'onPathInsert'); $this->listen(PathHookEvents::PATH_UPDATE, 'onPathUpdate'); $this->listen(PathHookEvents::PATH_DELETE, 'onPathDelete'); $this->pathAlias->save(); Loading @@ -79,7 +79,7 @@ class PathEventTest extends KernelTestBase { * @param \Drupal\path_event_dispatcher\Event\Path\PathInsertEvent $event * The event. */ public function onPathInsert(PathInsertEvent $event) { public function onPathInsert(PathInsertEvent $event): void { $this->assertEquals($this->pathAlias->id(), $event->getPid()); $this->assertEquals($this->pathAlias->getPath(), $event->getSource()); $this->assertEquals($this->pathAlias->getAlias(), $event->getAlias()); Loading @@ -92,7 +92,7 @@ class PathEventTest extends KernelTestBase { * @param \Drupal\path_event_dispatcher\Event\Path\PathUpdateEvent $event * The event. */ public function onPathUpdate(PathUpdateEvent $event) { public function onPathUpdate(PathUpdateEvent $event): void { $this->assertEquals('updatedPath', $event->getSource()); $this->assertEquals('updatedAlias', $event->getAlias()); } Loading @@ -103,7 +103,7 @@ class PathEventTest extends KernelTestBase { * @param \Drupal\path_event_dispatcher\Event\Path\PathDeleteEvent $event * The event. */ public function onPathDelete(PathDeleteEvent $event) { public function onPathDelete(PathDeleteEvent $event): void { $this->assertFalse($event->isRedirect()); } Loading Loading
modules/path_event_dispatcher/src/Event/Path/PathDeleteEvent.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\path_event_dispatcher\Event\Path; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\path_event_dispatcher\PathHookEvents; /** * Class PathDeleteEvent. Loading @@ -26,7 +26,7 @@ final class PathDeleteEvent extends AbstractPathEvent { * The dispatcher type. */ public function getDispatcherType(): string { return HookEventDispatcherInterface::PATH_DELETE; return PathHookEvents::PATH_DELETE; } }
modules/path_event_dispatcher/src/Event/Path/PathInsertEvent.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\path_event_dispatcher\Event\Path; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\path_event_dispatcher\PathHookEvents; /** * Class PathInsertEvent. Loading @@ -16,7 +16,7 @@ final class PathInsertEvent extends AbstractPathEvent { * The dispatcher type. */ public function getDispatcherType(): string { return HookEventDispatcherInterface::PATH_INSERT; return PathHookEvents::PATH_INSERT; } }
modules/path_event_dispatcher/src/Event/Path/PathUpdateEvent.php +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Drupal\path_event_dispatcher\Event\Path; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\path_event_dispatcher\PathHookEvents; /** * Class UpdatePathEvent. Loading @@ -16,7 +16,7 @@ final class PathUpdateEvent extends AbstractPathEvent { * The dispatcher type. */ public function getDispatcherType(): string { return HookEventDispatcherInterface::PATH_UPDATE; return PathHookEvents::PATH_UPDATE; } }
modules/path_event_dispatcher/src/PathHookEvents.php 0 → 100644 +48 −0 Original line number Diff line number Diff line <?php namespace Drupal\path_event_dispatcher; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; /** * Defines events for path hooks. */ final class PathHookEvents { /** * Respond to a path being inserted. * * @Event * * @see \Drupal\path_event_dispatcher\Event\Path\PathInsertEvent * @see path_event_dispatcher_path_alias_insert() * * @var string */ public const PATH_INSERT = HookEventDispatcherInterface::PREFIX . 'path.insert'; /** * Respond to a path being updated. * * @Event * * @see \Drupal\path_event_dispatcher\Event\Path\PathUpdateEvent * @see path_event_dispatcher_path_alias_update() * * @var string */ public const PATH_UPDATE = HookEventDispatcherInterface::PREFIX . 'path.update'; /** * Respond to a path being deleted. * * @Event * * @see \Drupal\path_event_dispatcher\Event\Path\PathDeleteEvent * @see path_event_dispatcher_path_alias_delete() * * @var string */ public const PATH_DELETE = HookEventDispatcherInterface::PREFIX . 'path.delete'; }
modules/path_event_dispatcher/tests/src/Kernel/PathEventTest.php +7 −7 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ namespace Drupal\Tests\path_event_dispatcher\Kernel; use Drupal\hook_event_dispatcher\HookEventDispatcherInterface; use Drupal\KernelTests\KernelTestBase; use Drupal\path_event_dispatcher\Event\Path\PathDeleteEvent; use Drupal\path_event_dispatcher\Event\Path\PathInsertEvent; use Drupal\path_event_dispatcher\Event\Path\PathUpdateEvent; use Drupal\path_event_dispatcher\PathHookEvents; use Drupal\Tests\hook_event_dispatcher\Kernel\ListenerTrait; /** Loading Loading @@ -60,9 +60,9 @@ class PathEventTest extends KernelTestBase { * @throws \Exception */ public function testPathInsertEvent(): void { $this->listen(HookEventDispatcherInterface::PATH_INSERT, 'onPathInsert'); $this->listen(HookEventDispatcherInterface::PATH_UPDATE, 'onPathUpdate'); $this->listen(HookEventDispatcherInterface::PATH_DELETE, 'onPathDelete'); $this->listen(PathHookEvents::PATH_INSERT, 'onPathInsert'); $this->listen(PathHookEvents::PATH_UPDATE, 'onPathUpdate'); $this->listen(PathHookEvents::PATH_DELETE, 'onPathDelete'); $this->pathAlias->save(); Loading @@ -79,7 +79,7 @@ class PathEventTest extends KernelTestBase { * @param \Drupal\path_event_dispatcher\Event\Path\PathInsertEvent $event * The event. */ public function onPathInsert(PathInsertEvent $event) { public function onPathInsert(PathInsertEvent $event): void { $this->assertEquals($this->pathAlias->id(), $event->getPid()); $this->assertEquals($this->pathAlias->getPath(), $event->getSource()); $this->assertEquals($this->pathAlias->getAlias(), $event->getAlias()); Loading @@ -92,7 +92,7 @@ class PathEventTest extends KernelTestBase { * @param \Drupal\path_event_dispatcher\Event\Path\PathUpdateEvent $event * The event. */ public function onPathUpdate(PathUpdateEvent $event) { public function onPathUpdate(PathUpdateEvent $event): void { $this->assertEquals('updatedPath', $event->getSource()); $this->assertEquals('updatedAlias', $event->getAlias()); } Loading @@ -103,7 +103,7 @@ class PathEventTest extends KernelTestBase { * @param \Drupal\path_event_dispatcher\Event\Path\PathDeleteEvent $event * The event. */ public function onPathDelete(PathDeleteEvent $event) { public function onPathDelete(PathDeleteEvent $event): void { $this->assertFalse($event->isRedirect()); } Loading