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

CPS-IT / handlebars / 19458389579

18 Nov 2025 07:54AM UTC coverage: 90.428% (-1.1%) from 91.533%
19458389579

Pull #488

github

web-flow
Merge bea7e324b into 328f4555d
Pull Request #488: [FEATURE] Provide site set for content element rendering

0 of 13 new or added lines in 2 files covered. (0.0%)

973 of 1076 relevant lines covered (90.43%)

5.14 hits per line

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

0.0
/Classes/Renderer/Helper/Fluid/ViewHelperInvoker.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 CPSIT\Typo3Handlebars\Renderer\Helper\Fluid;
19

20
use CPSIT\Typo3Handlebars\Attribute;
21
use CPSIT\Typo3Handlebars\Renderer;
22
use DevTheorem\Handlebars;
23
use Psr\Http\Message;
24
use TYPO3\CMS\Fluid;
25

26
/**
27
 * ViewHelperInvoker
28
 *
29
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
30
 * @license GPL-2.0-or-later
31
 * @internal
32
 */
33
#[Attribute\AsHelper('viewHelper')]
34
final class ViewHelperInvoker implements Renderer\Helper\Helper
35
{
36
    private ?Fluid\Core\Rendering\RenderingContext $renderingContext = null;
37

NEW
38
    public function __construct(
×
39
        private readonly Fluid\Core\Rendering\RenderingContextFactory $renderingContextFactory,
NEW
40
    ) {}
×
41

NEW
42
    public function render(Handlebars\HelperOptions $options, string $name = ''): mixed
×
43
    {
NEW
44
        $this->renderingContext ??= $this->renderingContextFactory->create();
×
45

NEW
46
        if (!$this->renderingContext->hasAttribute(Message\ServerRequestInterface::class)) {
×
NEW
47
            $this->renderingContext->setAttribute(Message\ServerRequestInterface::class, $GLOBALS['TYPO3_REQUEST']);
×
48
        }
49

50
        // @todo add validation
NEW
51
        [$namespace, $viewHelperShortName] = \explode(':', $name, 2);
×
NEW
52
        $className = $this->renderingContext->getViewHelperResolver()->createViewHelperInstance($namespace, $viewHelperShortName);
×
53

NEW
54
        return $this->renderingContext->getViewHelperInvoker()->invoke($className, $options->hash, $this->renderingContext, $options->fn);
×
55
    }
56

NEW
57
    public function setRenderingContext(Fluid\Core\Rendering\RenderingContext $renderingContext): void
×
58
    {
NEW
59
        $this->renderingContext = $renderingContext;
×
60
    }
61
}
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