Added additional callback during quick reply
authorAlexander Ebert <ebert@woltlab.com>
Fri, 3 Jun 2016 23:20:43 +0000 (01:20 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 3 Jun 2016 23:20:43 +0000 (01:20 +0200)
Allows to inject additional data before reading the message list.

wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php

index bf4c9654648802d890d10bb4d7e182645769451d..9cc3f4d656450ec585fd3189fe8d7585e59883a9 100644 (file)
@@ -176,9 +176,10 @@ class QuickReplyManager extends SingletonFactory {
         * @param       string                                  $sortOrder
         * @param       string                                  $templateName
         * @param       string                                  $application
+        * @param       callable                                $callbackCreatedMessage
         * @return      array
         */
-       public function createMessage(IMessageQuickReplyAction $object, array &$parameters, $containerActionClassName, $sortOrder, $templateName, $application = 'wcf') {
+       public function createMessage(IMessageQuickReplyAction $object, array &$parameters, $containerActionClassName, $sortOrder, $templateName, $application = 'wcf', callable $callbackCreatedMessage = null) {
                $additionalFields = [];
                EventHandler::getInstance()->fireAction($this, 'createMessage', $additionalFields);
                
@@ -205,6 +206,10 @@ class QuickReplyManager extends SingletonFactory {
                $eventParameters = ['message' => $message];
                EventHandler::getInstance()->fireAction($this, 'createdMessage', $eventParameters);
                
+               if ($callbackCreatedMessage !== null) {
+                       $callbackCreatedMessage($message);
+               }
+               
                if ($message instanceof IMessage && !$message->isVisible()) {
                        return ['isVisible' => false];
                }