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

CPS-IT / handlebars / 19133936680

06 Nov 2025 11:19AM UTC coverage: 90.411% (-1.2%) from 91.576%
19133936680

Pull #488

github

web-flow
Merge 9f9c337c1 into 145cc17cd
Pull Request #488: [FEATURE] Provide site set for content element rendering

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

924 of 1022 relevant lines covered (90.41%)

5.23 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
use TYPO3Fluid\Fluid as TYPO3Fluid;
26

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

NEW
40
    public function __construct(
×
41
        private readonly Fluid\Core\Rendering\RenderingContextFactory $renderingContextFactory,
42
    ) {
NEW
43
        $this->invoker = new TYPO3Fluid\Core\ViewHelper\ViewHelperInvoker();
×
44
    }
45

NEW
46
    public function render(Handlebars\HelperOptions $options, string $name = ''): mixed
×
47
    {
NEW
48
        $this->renderingContext ??= $this->renderingContextFactory->create();
×
49

NEW
50
        if (!$this->renderingContext->hasAttribute(Message\ServerRequestInterface::class)) {
×
NEW
51
            $this->renderingContext->setAttribute(Message\ServerRequestInterface::class, $GLOBALS['TYPO3_REQUEST']);
×
52
        }
53

54
        // @todo add validation
NEW
55
        [$namespace, $viewHelperShortName] = \explode(':', $name, 2);
×
NEW
56
        $className = $this->renderingContext->getViewHelperResolver()->createViewHelperInstance($namespace, $viewHelperShortName);
×
57

NEW
58
        return $this->invoker->invoke($className, $options->hash, $this->renderingContext, $options->fn);
×
59
    }
60

NEW
61
    public function setRenderingContext(Fluid\Core\Rendering\RenderingContext $renderingContext): void
×
62
    {
NEW
63
        $this->renderingContext = $renderingContext;
×
64
    }
65
}
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