From f6967c6127957a2474d4c9a3992d9d1c274771ed Mon Sep 17 00:00:00 2001
From: Oliver Bartsch <bo@cedev.de>
Date: Wed, 24 Aug 2022 15:12:45 +0200
Subject: [PATCH] [BUGFIX] Add resultArray reference for InlineControlContainer
 customControls hook

InlineControlContainer allows to add custom controls
via a userFunc (hook). However, since the resultArray
was not passed to the userFunc, e.g. no JS module
could be added for the custom control.

This is now fixed by passing the resultArray by reference
to the userFunc.

Resolves: #98199
Releases: main, 11.5
Change-Id: I404d2673a65bb40cf7f389fb5c0f7bec7dcd7c4c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75543
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benjamin Franzke <bfr@qbus.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
---
 .../backend/Classes/Form/Container/InlineControlContainer.php   | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php b/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php
index cc8e8934f617..9545f6c45f0b 100644
--- a/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php
+++ b/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php
@@ -372,6 +372,8 @@ class InlineControlContainer extends AbstractContainer
                     'nameForm' => $nameForm,
                     'config' => $config,
                     'customControlConfig' => $customControlConfig,
+                    // Warning: By reference should be used with care here and exists mostly to allow additional $resultArray['requireJsModules']
+                    'resultArray' => &$resultArray,
                 ];
                 $html .= GeneralUtility::callUserFunction($customControlConfig['userFunc'], $parameters, $this);
             }
-- 
GitLab