• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FluidTYPO3 / flux / 17432319284

03 Sep 2025 11:41AM UTC coverage: 92.919% (-0.3%) from 93.21%
17432319284

push

github

NamelessCoder
[TER] 11.0.4

7086 of 7626 relevant lines covered (92.92%)

66.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.79
/Classes/Controller/AbstractFluxController.php
1
<?php
2
declare(strict_types=1);
3
namespace FluidTYPO3\Flux\Controller;
4

5
/*
6
 * This file is part of the FluidTYPO3/Flux project under GPLv2 or later.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.md file that was distributed with this source code.
10
 */
11

12
use FluidTYPO3\Flux\Builder\RenderingContextBuilder;
13
use FluidTYPO3\Flux\Builder\RequestBuilder;
14
use FluidTYPO3\Flux\Builder\ViewBuilder;
15
use FluidTYPO3\Flux\Hooks\HookHandler;
16
use FluidTYPO3\Flux\Integration\NormalizedData\DataAccessTrait;
17
use FluidTYPO3\Flux\Integration\Resolver;
18
use FluidTYPO3\Flux\Provider\Interfaces\ControllerProviderInterface;
19
use FluidTYPO3\Flux\Provider\Interfaces\DataStructureProviderInterface;
20
use FluidTYPO3\Flux\Provider\Interfaces\FluidProviderInterface;
21
use FluidTYPO3\Flux\Provider\ProviderResolver;
22
use FluidTYPO3\Flux\Service\TypoScriptService;
23
use FluidTYPO3\Flux\Service\WorkspacesAwareRecordService;
24
use FluidTYPO3\Flux\Utility\ContentObjectFetcher;
25
use FluidTYPO3\Flux\Utility\ExtensionNamingUtility;
26
use FluidTYPO3\Flux\Utility\RecursiveArrayUtility;
27
use FluidTYPO3\Flux\ViewHelpers\FormViewHelper;
28
use Psr\Http\Message\ResponseFactoryInterface;
29
use Psr\Http\Message\ServerRequestInterface;
30
use TYPO3\CMS\Core\Utility\GeneralUtility;
31
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
32
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
33
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
34
use TYPO3\CMS\Extbase\Mvc\Controller\Arguments;
35
use TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface;
36
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
37
use TYPO3\CMS\Extbase\Mvc\Request;
38
use TYPO3\CMS\Extbase\Mvc\Response;
39
use TYPO3\CMS\Extbase\Mvc\ResponseInterface;
40
use TYPO3\CMS\Fluid\View\TemplateView;
41
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
42
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
43
use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer;
44
use TYPO3Fluid\Fluid\View\ViewInterface;
45

46
/**
47
 * Abstract Flux-enabled controller
48
 *
49
 * Extends a traditional ActionController with new services and methods
50
 * to ease interaction with Flux forms. Is not required as subclass for
51
 * Controllers rendering records associated with Flux - all it does is
52
 * ease the interaction by providing a common API.
53
 */
54
abstract class AbstractFluxController extends ActionController
55
{
56
    use DataAccessTrait;
57

58
    protected string $extensionName = 'FluidTYPO3.Flux';
59
    protected ?string $fluxRecordField = 'pi_flexform';
60
    protected ?string $fluxTableName = 'tt_content';
61
    protected array $data = [];
62

63
    protected RenderingContextBuilder $renderingContextBuilder;
64
    protected RequestBuilder $requestBuilder;
65
    protected WorkspacesAwareRecordService $recordService;
66
    protected TypoScriptService $typoScriptService;
67
    protected ProviderResolver $providerResolver;
68
    protected Resolver $resolver;
69
    protected ViewBuilder $viewBuilder;
70
    protected ?ControllerProviderInterface $provider = null;
71

72
    public function __construct(
73
        RenderingContextBuilder $renderingContextBuilder,
74
        RequestBuilder $requestBuilder,
75
        WorkspacesAwareRecordService $recordService,
76
        TypoScriptService $typoScriptService,
77
        ProviderResolver $providerResolver,
78
        Resolver $resolver,
79
        ViewBuilder $viewBuilder
80
    ) {
81
        $this->renderingContextBuilder = $renderingContextBuilder;
154✔
82
        $this->requestBuilder = $requestBuilder;
154✔
83
        $this->recordService = $recordService;
154✔
84
        $this->typoScriptService = $typoScriptService;
154✔
85
        $this->providerResolver = $providerResolver;
154✔
86
        $this->resolver = $resolver;
154✔
87
        $this->viewBuilder = $viewBuilder;
154✔
88

89
        /** @var Arguments $arguments */
90
        $arguments = GeneralUtility::makeInstance(Arguments::class);
154✔
91
        $this->arguments = $arguments;
154✔
92

93
        /** @var Request $request */
94
        $request = $requestBuilder->buildRequestFor(
154✔
95
            $this->extensionName,
154✔
96
            'Dummy',
154✔
97
            'render',
154✔
98
            '',
154✔
99
            [],
154✔
100
        );
154✔
101
        $this->request = $request;
154✔
102
    }
103

104
    protected function initializeSettings(): void
105
    {
106
        if ($this->provider === null) {
7✔
107
            return;
×
108
        }
109
        $row = $this->getRecord();
7✔
110
        $extensionKey = $this->provider->getControllerExtensionKeyFromRecord($row);
7✔
111
        $extensionName = ExtensionNamingUtility::getExtensionName($extensionKey);
7✔
112
        $pluginName = $this->request->getPluginName();
7✔
113
        $this->settings = RecursiveArrayUtility::merge(
7✔
114
            (array) $this->configurationManager->getConfiguration(
7✔
115
                ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS,
7✔
116
                $extensionName,
7✔
117
                $pluginName
7✔
118
            ),
7✔
119
            (array) $this->settings
7✔
120
        );
7✔
121

122
        if ($this->provider instanceof DataStructureProviderInterface) {
7✔
123
            $this->data = $this->provider->getFlexFormValues($row);
7✔
124
        }
125

126
        $overrides = HookHandler::trigger(
7✔
127
            HookHandler::CONTROLLER_SETTINGS_INITIALIZED,
7✔
128
            [
7✔
129
                'settings' => $this->settings,
7✔
130
                'data' => $this->data,
7✔
131
                'record' => $row,
7✔
132
                'provider' => $this->provider,
7✔
133
                'controller' => $this,
7✔
134
                'request' => $this->request,
7✔
135
                'extensionKey' => $extensionKey
7✔
136
            ]
7✔
137
        );
7✔
138
        $this->data = $overrides['data'];
7✔
139
        $this->settings = $overrides['settings'];
7✔
140
        $this->provider = $overrides['provider'];
7✔
141
    }
142

143
    protected function initializeOverriddenSettings(): void
144
    {
145
        if ($this->provider === null) {
35✔
146
            return;
×
147
        }
148
        $row = $this->getRecord();
35✔
149
        $extensionKey = $this->provider->getControllerExtensionKeyFromRecord($row);
35✔
150
        $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKey);
35✔
151
        if (is_array($this->data['settings'] ?? null)) {
35✔
152
            // a "settings." array is defined in the flexform configuration - extract it, use as "settings" in template
153
            // as well as the internal $this->settings array as per expected Extbase behavior.
154
            $this->settings = RecursiveArrayUtility::merge($this->settings, $this->data['settings'] ?? []);
28✔
155
        }
156
        if ($this->settings['useTypoScript'] ?? false) {
35✔
157
            // an override shared by all Flux enabled controllers: setting plugin.tx_EXTKEY.settings.useTypoScript = 1
158
            // will read the "settings" array from that location instead - thus excluding variables from the flexform
159
            // which are still available as $this->data but no longer available automatically in the template.
160
            $this->settings = $this->typoScriptService->getSettingsForExtensionName($extensionKey);
21✔
161
        }
162
    }
163

164
    protected function initializeProvider(): void
165
    {
166
        $row = $this->getRecord();
28✔
167
        $table = (string) $this->getFluxTableName();
28✔
168
        $field = $this->getFluxRecordField();
28✔
169
        $provider = $this->providerResolver->resolvePrimaryConfigurationProvider(
28✔
170
            $table,
28✔
171
            $field,
28✔
172
            $row,
28✔
173
            null,
28✔
174
            [ControllerProviderInterface::class]
28✔
175
        );
28✔
176
        if ($provider === null) {
28✔
177
            throw new \RuntimeException(
7✔
178
                'Unable to resolve a ConfigurationProvider, but controller indicates it is a Flux-enabled ' .
7✔
179
                'Controller - this is a grave error and indicates that EXT: ' . $this->extensionName . ' itself is ' .
7✔
180
                'broken - or that EXT:' . $this->extensionName . ' has been overridden by another implementation ' .
7✔
181
                'which is broken. The controller that caused this error was ' . get_class($this) . '".',
7✔
182
                1377458581
7✔
183
            );
7✔
184
        }
185
        $this->provider = $provider;
21✔
186
    }
187

188
    protected function initializeViewVariables(ViewInterface $view): void
189
    {
190
        $contentObject = $this->getContentObject();
7✔
191
        $row = $this->getRecord();
7✔
192

193
        $view->assign('contentObject', $contentObject);
7✔
194
        $view->assign('data', $contentObject instanceof ContentObjectRenderer ? $contentObject->data : null);
7✔
195
        if ($this->provider instanceof FluidProviderInterface) {
7✔
196
            $view->assignMultiple($this->provider->getTemplateVariables($row));
7✔
197
        }
198
        $view->assignMultiple($this->data);
7✔
199
        $view->assign('settings', $this->settings);
7✔
200
        $view->assign('provider', $this->provider);
7✔
201
        $view->assign('record', $row);
7✔
202

203
        HookHandler::trigger(
7✔
204
            HookHandler::CONTROLLER_VARIABLES_ASSIGNED,
7✔
205
            [
7✔
206
                'view' => $view,
7✔
207
                'record' => $row,
7✔
208
                'settings' => $this->settings,
7✔
209
                'provider' => $this->provider,
7✔
210
                'contentObject' => $contentObject,
7✔
211
            ]
7✔
212
        );
7✔
213
    }
214

215
    protected function initializeViewHelperVariableContainer(
216
        ViewHelperVariableContainer $viewHelperVariableContainer
217
    ): void {
218
        $viewHelperVariableContainer->add(FormViewHelper::class, 'provider', $this->provider);
7✔
219
        $viewHelperVariableContainer->add(
7✔
220
            FormViewHelper::class,
7✔
221
            'extensionName',
7✔
222
            $this->request->getControllerExtensionKey()
7✔
223
        );
7✔
224
        $viewHelperVariableContainer->add(
7✔
225
            FormViewHelper::class,
7✔
226
            'pluginName',
7✔
227
            $this->request->getPluginName()
7✔
228
        );
7✔
229
        $viewHelperVariableContainer->add(FormViewHelper::class, 'record', $this->getRecord());
7✔
230
    }
231

232
    protected function initializeAction(): void
233
    {
234
        $this->initializeProvider();
7✔
235
        $this->initializeSettings();
7✔
236
        $this->initializeOverriddenSettings();
7✔
237
    }
238

239
    protected function resolveView(): ViewInterface
240
    {
241
        if (!$this->provider instanceof ControllerProviderInterface) {
14✔
242
            throw new \RuntimeException(
×
243
                get_class($this) . ' cannot handle record; no ControllerProviderInterface could be resolved',
×
244
                1672082347
×
245
            );
×
246
        }
247

248
        $record = $this->getRecord();
14✔
249
        $extensionKey = ExtensionNamingUtility::getExtensionKey(
14✔
250
            $this->provider->getControllerExtensionKeyFromRecord($record)
14✔
251
        );
14✔
252

253
        $templatePathAndFilename = null;
14✔
254
        if ($this->provider instanceof FluidProviderInterface) {
14✔
255
            $templatePathAndFilename = $this->provider->getTemplatePathAndFilename($record);
14✔
256
        }
257

258
        $view = $this->viewBuilder->buildTemplateView(
14✔
259
            $extensionKey,
14✔
260
            $this->resolver->resolveControllerNameFromControllerClassName(get_class($this)),
14✔
261
            $this->provider->getControllerActionFromRecord($record),
14✔
262
            $this->provider->getPluginName() ?? $this->provider->getControllerNameFromRecord($record),
14✔
263
            $templatePathAndFilename,
14✔
264
            $this->request
14✔
265
        );
14✔
266

267
        $renderingContext = $view->getRenderingContext();
14✔
268

269
        $this->initializeViewVariables($view);
14✔
270
        $this->initializeViewHelperVariableContainer($renderingContext->getViewHelperVariableContainer());
14✔
271
        HookHandler::trigger(
14✔
272
            HookHandler::CONTROLLER_VIEW_INITIALIZED,
14✔
273
            [
14✔
274
                'view' => $view,
14✔
275
                'request' => $this->request,
14✔
276
                'provider' => $this->provider,
14✔
277
                'controller' => $this,
14✔
278
                'extensionKey' => $extensionKey
14✔
279
            ]
14✔
280
        );
14✔
281
        return $view;
14✔
282
    }
283

284
    /**
285
     * @return \Psr\Http\Message\ResponseInterface|Response
286
     */
287
    protected function createHtmlResponse(string $html = null)
288
    {
289
        if (method_exists($this, 'htmlResponse')) {
×
290
            return parent::htmlResponse($html);
×
291
        }
292
        $response = clone $this->response;
×
293
        $response->setContent((string) $html);
×
294
        return $response;
×
295
    }
296

297
    /**
298
     * Default action, proxy for "render". Added in order to
299
     * capture requests which use the Fluid-native "default"
300
     * action name when no specific action name is set in the
301
     * request. The "default" action is also returned by
302
     * vanilla Provider instances when registering them for
303
     * content object types or other ad-hoc registrations.
304
     *
305
     * @return \Psr\Http\Message\ResponseInterface|Response|ResponseInterface
306
     */
307
    public function defaultAction()
308
    {
309
        return $this->renderAction();
7✔
310
    }
311

312
    /**
313
     * Render content
314
     *
315
     * @return \Psr\Http\Message\ResponseInterface|Response|ResponseInterface
316
     */
317
    public function renderAction()
318
    {
319
        if (!$this->provider instanceof ControllerProviderInterface) {
14✔
320
            throw new \RuntimeException(
7✔
321
                get_class($this) . ' cannot handle record; no ControllerProviderInterface could be resolved',
7✔
322
                1672082347
7✔
323
            );
7✔
324
        }
325
        $row = $this->getRecord();
7✔
326
        $extensionKey = $this->provider->getControllerExtensionKeyFromRecord($row);
7✔
327
        $extensionSignature = ExtensionNamingUtility::getExtensionSignature($extensionKey);
7✔
328
        $pluginName = $this->request->getPluginName();
7✔
329
        $pluginSignature = strtolower('tx_' . $extensionSignature . '_' . $pluginName);
7✔
330
        $controllerExtensionKey = $this->provider->getControllerExtensionKeyFromRecord($row);
7✔
331
        $requestActionName = $this->resolveOverriddenFluxControllerActionNameFromRequestParameters($pluginSignature);
7✔
332
        $controllerActionName = $this->provider->getControllerActionFromRecord($row);
7✔
333
        $actualActionName = null !== $requestActionName ? $requestActionName : $controllerActionName;
7✔
334
        $controllerName = $this->request->getControllerName();
7✔
335

336
        return $this->performSubRendering(
7✔
337
            $controllerExtensionKey,
7✔
338
            $controllerName,
7✔
339
            $actualActionName,
7✔
340
            $pluginName,
7✔
341
            $pluginSignature
7✔
342
        );
7✔
343
    }
344

345
    protected function resolveOverriddenFluxControllerActionNameFromRequestParameters(string $pluginSignature): ?string
346
    {
347
        return $this->getServerRequest()->getQueryParams()[$pluginSignature]['action'] ?? null;
7✔
348
    }
349

350
    /**
351
     * @return \Psr\Http\Message\ResponseInterface|Response|ResponseInterface
352
     */
353
    protected function performSubRendering(
354
        string $extensionName,
355
        string $controllerName,
356
        string $actionName,
357
        string $pluginName,
358
        string $pluginSignature
359
    ) {
360
        if (property_exists($this, 'responseFactory') && $this->responseFactory instanceof ResponseFactoryInterface) {
21✔
361
            $response = $this->responseFactory->createResponse();
18✔
362
        } else {
363
            /** @var ResponseInterface $response */
364
            $response = GeneralUtility::makeInstance(Response::class);
3✔
365
        }
366
    
367
        $shouldRelay = $this->hasSubControllerActionOnForeignController($extensionName, $controllerName, $actionName);
21✔
368
        $foreignControllerClass = null;
21✔
369
        $content = null;
21✔
370
        if (!$shouldRelay) {
21✔
371
            if ($this->provider instanceof FluidProviderInterface) {
14✔
372
                $templatePathAndFilename = $this->provider->getTemplatePathAndFilename($this->getRecord());
7✔
373
                $vendorLessExtensionName = ExtensionNamingUtility::getExtensionName($extensionName);
7✔
374
                /** @var TemplateView $view */
375
                $view = $this->view;
7✔
376
                $renderingContext = $view->getRenderingContext();
7✔
377
                $paths = $renderingContext->getTemplatePaths();
7✔
378

379
                if (method_exists($this->request, 'setControllerExtensionName')) {
7✔
380
                    $this->request->setControllerExtensionName($vendorLessExtensionName);
4✔
381
                }
382

383
                if (method_exists($this->request, 'withControllerExtensionName')) {
7✔
384
                    $this->request = $this->request->withControllerExtensionName($vendorLessExtensionName);
6✔
385
                }
386

387
                $this->configurationManager->setConfiguration(
7✔
388
                    array_merge(
7✔
389
                        (array) $this->configurationManager->getConfiguration(
7✔
390
                            ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT,
7✔
391
                            $vendorLessExtensionName
7✔
392
                        ),
7✔
393
                        [
7✔
394
                            'extensionName' => $vendorLessExtensionName,
7✔
395
                        ]
7✔
396
                    )
7✔
397
                );
7✔
398
                $paths->setTemplatePathAndFilename((string) $templatePathAndFilename);
7✔
399
            }
400
            $content = $this->view->render();
14✔
401
        } else {
402
            $foreignControllerClass = $this->resolver->resolveFluxControllerClassNameByExtensionKeyAndControllerName(
7✔
403
                $extensionName,
7✔
404
                $controllerName
7✔
405
            );
7✔
406
            $content = $this->callSubControllerAction(
7✔
407
                $extensionName,
7✔
408
                $foreignControllerClass ?? static::class,
7✔
409
                $actionName,
7✔
410
                $pluginName,
7✔
411
                $pluginSignature
7✔
412
            );
7✔
413
        }
414
        $content = HookHandler::trigger(
21✔
415
            HookHandler::CONTROLLER_AFTER_RENDERING,
21✔
416
            [
21✔
417
                'view' => $this->view,
21✔
418
                'content' => $content,
21✔
419
                'request' => $this->request,
21✔
420
                'response' => $response,
21✔
421
                'extensionName' => $extensionName,
21✔
422
                'controllerClassName' => $foreignControllerClass,
21✔
423
                'controllerActionName' => $actionName
21✔
424
            ]
21✔
425
        )['content'];
21✔
426

427
        return $content instanceof \Psr\Http\Message\ResponseInterface || $content instanceof ResponseInterface
21✔
428
            ? $content
×
429
            : $this->createHtmlResponse($content);
21✔
430
    }
431

432
    protected function hasSubControllerActionOnForeignController(
433
        string $extensionName,
434
        string $controllerName,
435
        string $actionName
436
    ): bool {
437
        $potentialControllerClassName = $this->resolver->resolveFluxControllerClassNameByExtensionKeyAndControllerName(
7✔
438
            $extensionName,
7✔
439
            $controllerName
7✔
440
        );
7✔
441
        if ($potentialControllerClassName === null) {
7✔
442
            return false;
7✔
443
        }
444
        $isNotThis = get_class($this) !== $potentialControllerClassName;
×
445
        $isValidController = class_exists($potentialControllerClassName);
×
446
        return ($isNotThis && $isValidController
×
447
            && method_exists($potentialControllerClassName, $actionName . 'Action'));
×
448
    }
449

450
    /**
451
     * @param class-string $controllerClassName
452
     * @return \Psr\Http\Message\ResponseInterface|ResponseInterface|null
453
     */
454
    protected function callSubControllerAction(
455
        string $extensionName,
456
        string $controllerClassName,
457
        string $controllerActionName,
458
        string $pluginName,
459
        string $pluginSignature
460
    ) {
461
        $serverRequest = $this->getServerRequest();
7✔
462
        $arguments = $serverRequest->getQueryParams()[$pluginSignature] ?? [];
7✔
463
        $arguments = array_merge($arguments, ((array) $serverRequest->getParsedBody())[$pluginSignature] ?? []);
7✔
464

465
        $request = $this->requestBuilder->buildRequestFor(
7✔
466
            $extensionName,
7✔
467
            $this->resolver->resolveControllerNameFromControllerClassName(
7✔
468
                $controllerClassName
7✔
469
            ),
7✔
470
            $controllerActionName,
7✔
471
            $pluginName,
7✔
472
            $arguments
7✔
473
        );
7✔
474

475
        /** @var ControllerInterface $potentialControllerInstance */
476
        $potentialControllerInstance = GeneralUtility::makeInstance($controllerClassName);
7✔
477

478
        if (property_exists($this, 'responseFactory') && $this->responseFactory instanceof ResponseFactoryInterface) {
7✔
479
            /** @var ResponseInterface\ $response */
480
            $response = $this->responseFactory->createResponse();
6✔
481
        } else {
482
            /** @var ResponseInterface $response */
483
            $response = GeneralUtility::makeInstance(Response::class);
1✔
484
        }
485

486
        try {
487
            HookHandler::trigger(
7✔
488
                HookHandler::CONTROLLER_BEFORE_REQUEST,
7✔
489
                [
7✔
490
                    'request' => $this->request,
7✔
491
                    'response' => $response,
7✔
492
                    'extensionName' => $extensionName,
7✔
493
                    'controllerClassName' => $controllerClassName,
7✔
494
                    'controllerActionName' => $controllerActionName
7✔
495
                ]
7✔
496
            );
7✔
497

498
            /** @var \Psr\Http\Message\ResponseInterface|ResponseInterface|null $responseFromCall */
499
            $responseFromCall = $potentialControllerInstance->processRequest($request, $response);
7✔
500
            if ($responseFromCall) {
7✔
501
                $response = $responseFromCall;
7✔
502
            }
503
        } catch (StopActionException $error) {
×
504
            // intentionally left blank
505
        }
506
        HookHandler::trigger(
7✔
507
            HookHandler::CONTROLLER_AFTER_REQUEST,
7✔
508
            [
7✔
509
                'request' => $this->request,
7✔
510
                'response' => $response,
7✔
511
                'extensionName' => $extensionName,
7✔
512
                'controllerClassName' => $controllerClassName,
7✔
513
                'controllerActionName' => $controllerActionName
7✔
514
            ]
7✔
515
        );
7✔
516

517
        return $response;
7✔
518
    }
519

520
    /**
521
     * Get the data stored in a record's Flux-enabled field,
522
     * i.e. the variables of the Flux template as configured in this
523
     * particular record.
524
     */
525
    protected function getData(): array
526
    {
527
        return $this->data;
7✔
528
    }
529

530
    protected function getFluxRecordField(): ?string
531
    {
532
        return $this->fluxRecordField;
21✔
533
    }
534

535
    protected function getFluxTableName(): ?string
536
    {
537
        return $this->fluxTableName;
35✔
538
    }
539

540
    public function getRecord(): array
541
    {
542
        $contentObject = $this->getContentObject();
28✔
543
        if ($contentObject === null) {
28✔
544
            throw new \UnexpectedValueException(
7✔
545
                "Record of table " . $this->getFluxTableName() . ' not found',
7✔
546
                1666538343
7✔
547
            );
7✔
548
        }
549

550
        if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '11.5', '<')) {
21✔
551
            /** @var TypoScriptFrontendController|null $tsfe */
552
            $tsfe = $GLOBALS['TSFE'] ?? null;
3✔
553
        } else {
554
            $tsfe = $contentObject->getTypoScriptFrontendController();
18✔
555
        }
556
        if ($tsfe === null) {
21✔
557
            throw new \UnexpectedValueException(
×
558
                "Record of table " . $this->getFluxTableName() . ' not found',
×
559
                1729864782
×
560
            );
×
561
        }
562

563
        [$table, $recordUid] = GeneralUtility::trimExplode(
21✔
564
            ':',
21✔
565
            $tsfe->currentRecord ?: $contentObject->currentRecord
21✔
566
        );
21✔
567
        $record = $this->recordService->getSingle($table, '*', (integer) $recordUid);
21✔
568
        if ($record === null) {
21✔
569
            throw new \UnexpectedValueException(
×
570
                "Record of table " . $this->getFluxTableName() . ' not found',
×
571
                1729864698
×
572
            );
×
573
        }
574

575
        if ($record['_LOCALIZED_UID'] ?? false) {
21✔
576
            $record = array_merge(
×
577
                $record,
×
578
                $this->recordService->getSingle(
×
579
                    (string) $this->getFluxTableName(),
×
580
                    '*',
×
581
                    $record['_LOCALIZED_UID']
×
582
                ) ?? $record
×
583
            );
×
584
        }
585
        return $record;
21✔
586
    }
587

588
    protected function getContentObject(): ?ContentObjectRenderer
589
    {
590
        return ContentObjectFetcher::resolve($this->configurationManager);
×
591
    }
592

593
    protected function getServerRequest(): ServerRequestInterface
594
    {
595
        /** @var ServerRequestInterface $request */
596
        $request = $GLOBALS['TYPO3_REQUEST'];
×
597
        return $request;
×
598
    }
599
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc