From 02adf385284b2328016555c166f23a0599592f68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 17 Feb 2021 11:25:13 +0100 Subject: [PATCH] Add support for reusable events to EventHandler --- .../lib/system/event/EventHandler.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wcfsetup/install/files/lib/system/event/EventHandler.class.php b/wcfsetup/install/files/lib/system/event/EventHandler.class.php index 3a8b4c4750..b64b40c759 100644 --- a/wcfsetup/install/files/lib/system/event/EventHandler.class.php +++ b/wcfsetup/install/files/lib/system/event/EventHandler.class.php @@ -20,6 +20,11 @@ use wcf\system\SingletonFactory; */ class EventHandler extends SingletonFactory { + /** + * @since 5.5 + */ + public const DEFAULT_EVENT_NAME = ':default'; + /** * registered actions * @var array @@ -260,6 +265,17 @@ class EventHandler extends SingletonFactory } } + /** + * Calls fireAction() for the given event with the `:default` event name. + * + * @see EventHandler::fireAction() + * @since 5.5 + */ + public function fire(IEvent $event): void + { + $this->fireAction($event, self::DEFAULT_EVENT_NAME); + } + /** * Generates an unique name for an action. * -- 2.20.1