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

CPS-IT / handlebars / 15461925183

05 Jun 2025 08:11AM UTC coverage: 90.937% (-1.9%) from 92.804%
15461925183

push

github

web-flow
Merge pull request #434 from CPS-IT/feature/typo3-v13

[!!!][FEATURE] Add support for TYPO3 v13.4, drop support for TYPO3 v12.4

69 of 86 new or added lines in 9 files covered. (80.23%)

2 existing lines in 1 file now uncovered.

883 of 971 relevant lines covered (90.94%)

5.52 hits per line

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

95.0
/Classes/Extbase/View/ExtbaseHandlebarsView.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "handlebars".
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17

18
namespace Fr\Typo3Handlebars\Extbase\View;
19

20
use TYPO3\CMS\Core;
21
use TYPO3\CMS\Frontend;
22

23
/**
24
 * ExtbaseHandlebarsView
25
 *
26
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
27
 * @license GPL-2.0-or-later
28
 */
29
final class ExtbaseHandlebarsView implements Core\View\ViewInterface
30
{
31
    /**
32
     * @param array<string, mixed> $contentObjectConfiguration
33
     */
34
    public function __construct(
5✔
35
        private readonly Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer,
36
        private readonly Core\TypoScript\TypoScriptService $typoScriptService,
37
        private array $contentObjectConfiguration,
38
    ) {}
5✔
39

40
    public function assign(string $key, mixed $value): self
3✔
41
    {
42
        // Maintain TypoScript object structure
43
        if (\is_array($value)) {
3✔
44
            $key .= '.';
1✔
45
            $value = $this->typoScriptService->convertPlainArrayToTypoScriptArray($value);
1✔
46
        }
47

48
        $this->contentObjectConfiguration['variables.'][$key] = $value;
3✔
49

50
        return $this;
3✔
51
    }
52

53
    /**
54
     * @param array<string, mixed> $values
55
     */
56
    public function assignMultiple(array $values): self
1✔
57
    {
58
        foreach ($values as $key => $value) {
1✔
59
            $this->assign($key, $value);
1✔
60
        }
61

62
        return $this;
1✔
63
    }
64

65
    public function render(string $templateFileName = ''): string
5✔
66
    {
67
        $contentObjectConfiguration = $this->contentObjectConfiguration;
5✔
68

69
        if ($templateFileName !== '') {
5✔
NEW
70
            $contentObjectConfiguration['templateName'] = $templateFileName;
×
71
        }
72

73
        return $this->contentObjectRenderer->cObjGetSingle('HANDLEBARSTEMPLATE', $contentObjectConfiguration);
5✔
74
    }
75

76
    public function setTemplateName(string $templateName): self
1✔
77
    {
78
        $this->contentObjectConfiguration['templateName'] = $templateName;
1✔
79

80
        return $this;
1✔
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