Add event in `BoxHandler::loadBoxes()`
authorMatthias Schmidt <gravatronics@live.com>
Fri, 27 Sep 2019 14:25:03 +0000 (16:25 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 27 Sep 2019 14:25:03 +0000 (16:25 +0200)
wcfsetup/install/files/lib/system/box/BoxHandler.class.php

index ed8d3e133c8b6366e301c724fbb69c921b6b97d2..ccd10a772b659bedadff8eb7929df286dbf7f12c 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\box\Box;
 use wcf\data\box\BoxList;
 use wcf\data\condition\ConditionAction;
 use wcf\data\page\Page;
+use wcf\system\event\EventHandler;
 use wcf\system\request\RequestHandler;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
@@ -253,6 +254,20 @@ class BoxHandler extends SingletonFactory {
                        }
                }
                
+               $parameters = [
+                       'boxes' => $boxes,
+                       'forDisplay' => $forDisplay,
+                       'pageID' => $pageID
+               ];
+               
+               EventHandler::getInstance()->fireAction(static::class, 'loadBoxes', $parameters);
+               
+               if (!isset($parameters['boxes']) || !is_array($parameters['boxes'])) {
+                       throw new \UnexpectedValueException("'boxes' parameter is no longer an array.");
+               }
+               
+               $boxes = $parameters['boxes'];
+               
                foreach ($boxes as &$positionBoxes) {
                        usort($positionBoxes, function($a, $b) {
                                if ($a->virtualShowOrder == $b->virtualShowOrder) {