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

TYPO3-Headless / headless / 25562644868

08 May 2026 02:57PM UTC coverage: 74.7%. Remained the same
25562644868

push

github

lukaszuznanski
[FEATURE] TYPO3 v14 compatibility (5.0.0-rc1)

Drops support for TYPO3 12/13. Bumps required PHP/TYPO3 versions,
removes deprecated PreviewController XClass, adds LanguageMenuProcessor
and assorted v14 adaptations across data processors, middlewares,
SEO, and tests.

38 of 58 new or added lines in 10 files covered. (65.52%)

63 existing lines in 6 files now uncovered.

1181 of 1581 relevant lines covered (74.7%)

6.63 hits per line

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

91.67
/Classes/XClass/TemplateView.php
1
<?php
2

3
/*
4
 * This file is part of the "headless" Extension for TYPO3 CMS.
5
 *
6
 * For the full copyright and license information, please read the
7
 * LICENSE.md file that was distributed with this source code.
8
 */
9

10
declare(strict_types=1);
11

12
namespace FriendsOfTYPO3\Headless\XClass;
13

14
use FriendsOfTYPO3\Headless\Utility\HeadlessModeInterface;
15
use Throwable;
16
use TYPO3\CMS\Core\Http\ApplicationType;
17
use TYPO3\CMS\Core\Utility\GeneralUtility;
18
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
19

20
use TYPO3Fluid\Fluid\View\Exception\InvalidTemplateResourceException;
21

22
use function extract;
23
use function ob_end_clean;
24
use function ob_get_clean;
25
use function ob_start;
26

27
class TemplateView extends \TYPO3Fluid\Fluid\View\TemplateView
28
{
29
    private ?HeadlessModeInterface $headlessMode = null;
30

31
    private function getHeadlessMode(): HeadlessModeInterface
32
    {
33
        return $this->headlessMode ??= GeneralUtility::makeInstance(HeadlessModeInterface::class);
5✔
34
    }
35

36
    public function render($actionName = null)
37
    {
38
        $headlessMode = $this->getHeadlessMode()->withRequest($GLOBALS['TYPO3_REQUEST']);
5✔
39

40
        if (!ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend() || !$headlessMode->isEnabled()) {
5✔
UNCOV
41
            return parent::render($actionName);
×
42
        }
43

44
        $renderingContext = $this->getCurrentRenderingContext();
5✔
45

46
        if ((int)($renderingContext->getVariableProvider()->get('settings')['phpTemplate'] ?? 0) !== 1) {
5✔
UNCOV
47
            return parent::render($actionName);
×
48
        }
49

50
        $templatePaths = $renderingContext->getTemplatePaths();
5✔
51
        if ($actionName) {
5✔
52
            $actionName = ucfirst($actionName);
1✔
53
            $renderingContext->setControllerAction($actionName);
1✔
54
        }
55

56
        $templateFile = $templatePaths->resolveTemplateFileForControllerAndActionAndFormat($renderingContext->getControllerName(), $renderingContext->getControllerAction(), 'php');
5✔
57

58
        if ($templateFile === null) {
5✔
59
            throw new InvalidTemplateResourceException('Template is not found', 1740000000);
2✔
60
        }
61

62
        return $this->loadTemplate($templateFile, $renderingContext);
3✔
63
    }
64

65
    private function loadTemplate(string $templateFile, RenderingContextInterface $renderingContext): string
66
    {
67
        $__jsonContent = '';
3✔
68

69
        try {
70
            extract($renderingContext->getVariableProvider()->getAll());
3✔
71

72
            ob_start();
3✔
73
            include $templateFile;
3✔
74
            $__jsonContent = ob_get_clean();
2✔
75
        } catch (Throwable $e) {
1✔
76
            ob_end_clean();
1✔
77
            throw $e;
1✔
78
        }
79

80
        return $__jsonContent;
2✔
81
    }
82
}
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