From 432bc62049bebd466b14afac13de4ae99ae685e7 Mon Sep 17 00:00:00 2001 From: Sven Wappler Date: Tue, 15 Oct 2024 10:25:10 +0200 Subject: [PATCH] Refactor FileReferenceContainer constructor to inject dependencies. --- .../Form/Container/FileReferenceContainer.php | 15 +++++++++++++++ ext_localconf.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Classes/Backend/Form/Container/FileReferenceContainer.php b/Classes/Backend/Form/Container/FileReferenceContainer.php index f73d3e5..2b7986d 100644 --- a/Classes/Backend/Form/Container/FileReferenceContainer.php +++ b/Classes/Backend/Form/Container/FileReferenceContainer.php @@ -11,13 +11,18 @@ namespace WapplerSystems\Videos\Backend\Form\Container; +use Psr\EventDispatcher\EventDispatcherInterface; use TYPO3\CMS\Backend\Form\Event\ModifyFileReferenceControlsEvent; use TYPO3\CMS\Backend\Form\Event\ModifyFileReferenceEnabledControlsEvent; +use TYPO3\CMS\Backend\Form\InlineStackProcessor; use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Imaging\Icon; +use TYPO3\CMS\Core\Imaging\IconFactory; +use TYPO3\CMS\Core\Resource\Index\MetaDataRepository; +use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Type\Bitmask\Permission; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; @@ -25,6 +30,16 @@ class FileReferenceContainer extends \TYPO3\CMS\Backend\Form\Container\FileReferenceContainer { + public function __construct( + private readonly IconFactory $iconFactory, + private readonly InlineStackProcessor $inlineStackProcessor, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly ResourceFactory $resourceFactory, + private readonly ConnectionPool $connectionPool, + private readonly UriBuilder $uriBuilder, + private readonly MetaDataRepository $metaDataRepository, + ) {} + protected function renderFileReferenceHeaderControl(): string { $controls = []; diff --git a/ext_localconf.php b/ext_localconf.php index 6d2a844..41b0335 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -11,7 +11,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1712229824] = [ - 'nodeName' => FileReferenceContainer::NODE_TYPE_IDENTIFIER, + 'nodeName' => 'fileReferenceContainer', 'priority' => '70', 'class' => FileReferenceContainer::class, ];