Skip to content

Commit b3d004e

Browse files
committed
[TASK] TYPO3 update step 2: Add TYPO3 14 support
1 parent 6086088 commit b3d004e

72 files changed

Lines changed: 522 additions & 532 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Classes/Backend/Buttons/NavigationGroupButton.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace In2code\Lux\Backend\Buttons;
66

77
use TYPO3\CMS\Backend\Template\Components\Buttons\AbstractButton;
8-
use TYPO3\CMS\Core\Imaging\Icon;
98
use TYPO3\CMS\Core\Imaging\IconFactory;
9+
use TYPO3\CMS\Core\Imaging\IconSize;
1010
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
1111
use TYPO3\CMS\Core\Utility\GeneralUtility;
1212
use TYPO3\CMS\Extbase\Mvc\Request;
@@ -38,7 +38,7 @@ public function __construct(
3838
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
3939
}
4040

41-
public function render()
41+
public function render(): string
4242
{
4343
$content = $this->prepend();
4444
$content .= '<div class="lux btn-group" role="group">';
@@ -85,24 +85,24 @@ protected function append(string $content): string
8585

8686
protected function appendCommunity(string $content): string
8787
{
88-
$icon = $this->iconFactory->getIcon('extension-lux-star', Icon::SIZE_SMALL);
89-
$content .= '<div style="padding-top: 5px;">';
88+
$icon = $this->iconFactory->getIcon('extension-lux-star', IconSize::SMALL);
89+
$content .= '<div style="display: flex; align-items: center; padding-left: 5px;">';
9090
$content .= 'LUX Community Edition';
9191
$content .= '<a href="' . $this->getInfoUri() . '" style="margin-left: 5px;">';
92-
$content .= $this->iconFactory->getIcon('actions-info-circle-alt', Icon::SIZE_SMALL);
92+
$content .= $this->iconFactory->getIcon('actions-info-circle-alt', IconSize::SMALL);
9393
$content .= '</a></div>';
94-
$content .= '<a href="https://www.in2code.de/produkte/lux-typo3-marketing-automation/?utm_campaign=LUX+Community+Version&utm_id=llcv&utm_source=typo3&utm_medium=browser&utm_content=go+enterprise" class="lux_poweredby" style="color:currentColor !important; font-weight:bold; right:85px; position:absolute;" target="_blank" rel="noopener">';
94+
$content .= '<a href="https://www.in2code.de/produkte/lux-typo3-marketing-automation/?utm_campaign=LUX+Community+Version&utm_id=llcv&utm_source=typo3&utm_medium=browser&utm_content=go+enterprise" class="lux_poweredby" style="color:currentColor !important; font-weight:bold; position: absolute; right: 130px; top: 50%; transform: translateY(-50%); white-space: nowrap;" target="_blank" rel="noopener">';
9595
$content .= $icon->render();
9696
$content .= ' Go enterprise</a>';
9797
return $content;
9898
}
9999

100100
protected function appendEnterprise(string $content): string
101101
{
102-
$content .= '<div style="padding: 5px 0 0 5px;">';
102+
$content .= '<div style="display: flex; align-items: center; padding-left: 5px;">';
103103
$content .= 'LUX Enterprise Edition';
104104
$content .= '<a href="' . $this->getInfoUri() . '" style="margin-left: 5px;">';
105-
$content .= $this->iconFactory->getIcon('actions-info-circle-alt', Icon::SIZE_SMALL);
105+
$content .= $this->iconFactory->getIcon('actions-info-circle-alt', IconSize::SMALL);
106106
$content .= '</a></div>';
107107
return $content;
108108
}
@@ -117,7 +117,7 @@ public function __toString(): string
117117
return $this->render();
118118
}
119119

120-
public function isValid()
120+
public function isValid(): bool
121121
{
122122
return true;
123123
}

Classes/Backend/Units/AbstractUnit.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
use In2code\Lux\Utility\ObjectUtility;
1111
use In2code\Lux\Utility\StringUtility;
1212
use TYPO3\CMS\Core\Utility\GeneralUtility;
13-
use TYPO3\CMS\Fluid\View\StandaloneView;
13+
use TYPO3\CMS\Core\View\ViewFactoryData;
14+
use TYPO3\CMS\Core\View\ViewFactoryInterface;
1415

1516
abstract class AbstractUnit
1617
{
@@ -85,10 +86,10 @@ protected function initializeCacheLayer(): void
8586

8687
protected function getHtml(): string
8788
{
88-
$view = GeneralUtility::makeInstance(StandaloneView::class);
89-
$view->setTemplateRootPaths([$this->templateRootPath]);
90-
$view->setPartialRootPaths([$this->partialRootPath]);
91-
$view->setTemplate($this->getTemplatePath());
89+
$view = GeneralUtility::makeInstance(ViewFactoryInterface::class)->create(new ViewFactoryData(
90+
templateRootPaths: [$this->templateRootPath],
91+
partialRootPaths: [$this->partialRootPath],
92+
));
9293
$view->assignMultiple([
9394
'cacheLayerClass' => $this->cacheLayerClass,
9495
'cacheLayerFunction' => $this->cacheLayerFunction,
@@ -98,7 +99,7 @@ protected function getHtml(): string
9899
'filter' => $this->filter,
99100
'arguments' => $this->arguments,
100101
] + $this->assignAdditionalVariables());
101-
return $view->render();
102+
return $view->render($this->getTemplatePath());
102103
}
103104

104105
protected function assignAdditionalVariables(): array

Classes/Command/LuxCacheWarmupCommand.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
2121
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
2222
use TYPO3\CMS\Core\Utility\GeneralUtility;
23-
use TYPO3\CMS\Fluid\View\StandaloneView;
2423

2524
class LuxCacheWarmupCommand extends Command
2625
{
@@ -110,11 +109,14 @@ protected function warmupMultipleLayers(string $route, array $configuration): vo
110109
protected function substituteVariablesInArguments(array $arguments, array $row): array
111110
{
112111
foreach ($arguments as $key => $value) {
113-
if (stristr($value, '{')) {
114-
$standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
115-
$standaloneView->setTemplateSource($value);
116-
$standaloneView->assignMultiple($row);
117-
$arguments[$key] = $standaloneView->render();
112+
if (str_contains($value, '{')) {
113+
$arguments[$key] = preg_replace_callback(
114+
'~\{(\w+)\}~',
115+
static function (array $matches) use ($row): string {
116+
return (string)($row[$matches[1]] ?? $matches[0]);
117+
},
118+
$value
119+
);
118120
}
119121
}
120122
return $arguments;

Classes/Controller/AbstractController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
3939
use TYPO3\CMS\Core\Imaging\IconFactory;
4040
use TYPO3\CMS\Core\Utility\GeneralUtility;
41+
use TYPO3\CMS\Core\View\ViewFactoryInterface;
4142
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
4243
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
4344

@@ -66,7 +67,8 @@ public function __construct(
6667
protected readonly RenderingTimeService $renderingTimeService,
6768
protected readonly CacheLayer $cacheLayer,
6869
protected readonly ModuleTemplateFactory $moduleTemplateFactory,
69-
protected readonly IconFactory $iconFactory
70+
protected readonly IconFactory $iconFactory,
71+
protected readonly ViewFactoryInterface $viewFactory
7072
) {
7173
}
7274

Classes/Controller/AnalysisController.php

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
use In2code\Lux\Exception\AuthenticationException;
3535
use In2code\Lux\Utility\BackendUtility;
3636
use In2code\Lux\Utility\LocalizationUtility;
37-
use In2code\Lux\Utility\ObjectUtility;
3837
use Psr\Http\Message\ResponseInterface;
3938
use Psr\Http\Message\ServerRequestInterface;
4039
use Psr\Http\Message\StreamInterface;
4140
use TYPO3\CMS\Core\Http\JsonResponse;
4241
use TYPO3\CMS\Core\Utility\GeneralUtility;
42+
use TYPO3\CMS\Core\View\ViewFactoryData;
4343
use TYPO3\CMS\Extbase\Http\ForwardResponse;
4444
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
4545
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
@@ -539,19 +539,18 @@ public function detailAjaxPage(ServerRequestInterface $request): ResponseInterfa
539539
'Analysis',
540540
['searchterm' => (string)$request->getQueryParams()['page'], 'limit' => 10]
541541
);
542-
$standaloneView = ObjectUtility::getStandaloneView();
543-
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
544-
'EXT:lux/Resources/Private/Templates/Analysis/ContentDetailPageAjax.html'
542+
$view = $this->viewFactory->create(new ViewFactoryData(
543+
templateRootPaths: ['EXT:lux/Resources/Private/Templates/'],
544+
partialRootPaths: ['EXT:lux/Resources/Private/Partials/'],
545545
));
546-
$standaloneView->setPartialRootPaths(['EXT:lux/Resources/Private/Partials/']);
547-
$standaloneView->assignMultiple([
546+
$view->assignMultiple([
548547
'pagevisits' => $this->pagevisitsRepository->findByFilter($filter),
549548
'numberOfVisitorsData' => GeneralUtility::makeInstance(PagevisistsDataProvider::class, $filter),
550549
]);
551550
$response = GeneralUtility::makeInstance(JsonResponse::class);
552551
/** @var StreamInterface $stream */
553552
$stream = $response->getBody();
554-
$stream->write(json_encode(['html' => $standaloneView->render()]));
553+
$stream->write(json_encode(['html' => $view->render('Analysis/ContentDetailPageAjax')]));
555554
return $response;
556555
}
557556

@@ -571,20 +570,19 @@ public function detailAjaxSource(ServerRequestInterface $request): ResponseInter
571570
'Analysis',
572571
['searchterm' => (string)$request->getQueryParams()['referrerDomain'], 'limit' => 10]
573572
);
574-
$standaloneView = ObjectUtility::getStandaloneView();
575-
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
576-
'EXT:lux/Resources/Private/Templates/Analysis/SourcesDetailAjax.html'
573+
$view = $this->viewFactory->create(new ViewFactoryData(
574+
templateRootPaths: ['EXT:lux/Resources/Private/Templates/'],
575+
partialRootPaths: ['EXT:lux/Resources/Private/Partials/'],
577576
));
578-
$standaloneView->setPartialRootPaths(['EXT:lux/Resources/Private/Partials/']);
579-
$standaloneView->assignMultiple([
577+
$view->assignMultiple([
580578
'filter' => $filter,
581579
'pagevisits' => $this->pagevisitsRepository->findByReferrerDomain($filter),
582580
'pagevisitsBySourceData' => GeneralUtility::makeInstance(PagevisistsBySourceDataProvider::class, $filter),
583581
]);
584582
$response = GeneralUtility::makeInstance(JsonResponse::class);
585583
/** @var StreamInterface $stream */
586584
$stream = $response->getBody();
587-
$stream->write(json_encode(['html' => $standaloneView->render()]));
585+
$stream->write(json_encode(['html' => $view->render('Analysis/SourcesDetailAjax')]));
588586
return $response;
589587
}
590588

@@ -606,20 +604,19 @@ public function detailNewsAjaxPage(ServerRequestInterface $request): ResponseInt
606604
);
607605
/** @var News $news */
608606
$news = $this->newsRepository->findByIdentifier((int)$request->getQueryParams()['news']);
609-
$standaloneView = ObjectUtility::getStandaloneView();
610-
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
611-
'EXT:lux/Resources/Private/Templates/Analysis/NewsDetailPageAjax.html'
607+
$view = $this->viewFactory->create(new ViewFactoryData(
608+
templateRootPaths: ['EXT:lux/Resources/Private/Templates/'],
609+
partialRootPaths: ['EXT:lux/Resources/Private/Partials/'],
612610
));
613-
$standaloneView->setPartialRootPaths(['EXT:lux/Resources/Private/Partials/']);
614-
$standaloneView->assignMultiple([
611+
$view->assignMultiple([
615612
'news' => $news,
616613
'newsvisits' => $this->newsvisitRepository->findByFilter($filter),
617614
'newsvisitsData' => GeneralUtility::makeInstance(NewsvisistsDataProvider::class, $filter),
618615
]);
619616
$response = GeneralUtility::makeInstance(JsonResponse::class);
620617
/** @var StreamInterface $stream */
621618
$stream = $response->getBody();
622-
$stream->write(json_encode(['html' => $standaloneView->render()]));
619+
$stream->write(json_encode(['html' => $view->render('Analysis/NewsDetailPageAjax')]));
623620
return $response;
624621
}
625622

@@ -645,25 +642,24 @@ public function detailUtmAjaxPage(ServerRequestInterface $request): ResponseInte
645642
*/
646643
public function detailSearchAjaxPage(ServerRequestInterface $request): ResponseInterface
647644
{
648-
$standaloneView = ObjectUtility::getStandaloneView();
649-
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
650-
'EXT:lux/Resources/Private/Templates/Analysis/SearchDetailPageAjax.html'
645+
$view = $this->viewFactory->create(new ViewFactoryData(
646+
templateRootPaths: ['EXT:lux/Resources/Private/Templates/'],
647+
partialRootPaths: ['EXT:lux/Resources/Private/Partials/'],
651648
));
652-
$standaloneView->setPartialRootPaths(['EXT:lux/Resources/Private/Partials/']);
653649
$filter = BackendUtility::getFilterFromSession(
654650
'search',
655651
'Analysis',
656652
['searchterm' => urldecode($request->getQueryParams()['searchterm']), 'limit' => 10]
657653
);
658-
$standaloneView->assignMultiple([
654+
$view->assignMultiple([
659655
'searches' => $this->searchRepository->findByFilter($filter),
660656
'searchterm' => urldecode($request->getQueryParams()['searchterm']),
661657
'searchData' => GeneralUtility::makeInstance(SearchDataProvider::class, $filter),
662658
]);
663659
$response = GeneralUtility::makeInstance(JsonResponse::class);
664660
/** @var StreamInterface $stream */
665661
$stream = $response->getBody();
666-
$stream->write(json_encode(['html' => $standaloneView->render()]));
662+
$stream->write(json_encode(['html' => $view->render('Analysis/SearchDetailPageAjax')]));
667663
return $response;
668664
}
669665

@@ -682,19 +678,18 @@ public function detailAjaxDownload(ServerRequestInterface $request): ResponseInt
682678
'Analysis',
683679
['href' => (string)$request->getQueryParams()['download'], 'limit' => 10]
684680
);
685-
$standaloneView = ObjectUtility::getStandaloneView();
686-
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
687-
'EXT:lux/Resources/Private/Templates/Analysis/ContentDetailDownloadAjax.html'
681+
$view = $this->viewFactory->create(new ViewFactoryData(
682+
templateRootPaths: ['EXT:lux/Resources/Private/Templates/'],
683+
partialRootPaths: ['EXT:lux/Resources/Private/Partials/'],
688684
));
689-
$standaloneView->setPartialRootPaths(['EXT:lux/Resources/Private/Partials/']);
690-
$standaloneView->assignMultiple([
685+
$view->assignMultiple([
691686
'downloads' => $this->downloadRepository->findByFilter($filter),
692687
'numberOfDownloadsData' => GeneralUtility::makeInstance(DownloadsDataProvider::class, $filter),
693688
]);
694689
$response = GeneralUtility::makeInstance(JsonResponse::class);
695690
/** @var StreamInterface $stream */
696691
$stream = $response->getBody();
697-
$stream->write(json_encode(['html' => $standaloneView->render()]));
692+
$stream->write(json_encode(['html' => $view->render('Analysis/ContentDetailDownloadAjax')]));
698693
return $response;
699694
}
700695

@@ -711,19 +706,18 @@ public function detailAjaxLinklistener(ServerRequestInterface $request): Respons
711706
'Analysis',
712707
['searchterm' => (string)$request->getQueryParams()['linkListener'], 'limit' => 10]
713708
);
714-
$standaloneView = ObjectUtility::getStandaloneView();
715-
$standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
716-
'EXT:lux/Resources/Private/Templates/Analysis/LinkListenerAjax.html'
709+
$view = $this->viewFactory->create(new ViewFactoryData(
710+
templateRootPaths: ['EXT:lux/Resources/Private/Templates/'],
711+
partialRootPaths: ['EXT:lux/Resources/Private/Partials/'],
717712
));
718-
$standaloneView->setPartialRootPaths(['EXT:lux/Resources/Private/Partials/']);
719-
$standaloneView->assignMultiple([
713+
$view->assignMultiple([
720714
'linkclicks' => $this->linkclickRepository->findByFilter($filter),
721715
'allLinkclickData' => GeneralUtility::makeInstance(AllLinkclickDataProvider::class, $filter),
722716
]);
723717
$response = GeneralUtility::makeInstance(JsonResponse::class);
724718
/** @var StreamInterface $stream */
725719
$stream = $response->getBody();
726-
$stream->write(json_encode(['html' => $standaloneView->render()]));
720+
$stream->write(json_encode(['html' => $view->render('Analysis/LinkListenerAjax')]));
727721
return $response;
728722
}
729723

0 commit comments

Comments
 (0)