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

FluidTYPO3 / vhs / 30001290505

23 Jul 2026 10:57AM UTC coverage: 70.309% (-1.7%) from 72.022%
30001290505

push

github

NamelessCoder
[TER] 8.0.0

4819 of 6854 relevant lines covered (70.31%)

6.54 hits per line

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

80.0
/Classes/ViewHelpers/Variable/Register/GetViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Variable\Register;
3

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

11
use FluidTYPO3\Vhs\Core\ViewHelper\AbstractViewHelper;
12
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
13
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
14

15
/**
16
 * ### Variable\Register: Get
17
 *
18
 * ViewHelper used to read the value of a TSFE-register
19
 * Can be used to read names of variables which contain dynamic parts:
20
 *
21
 * ```
22
 * <!-- if {variableName} is "Name", outputs value of {dynamicName} -->
23
 * {v:variable.register.get(name: 'dynamic{variableName}')}
24
 * ```
25
 */
26
class GetViewHelper extends AbstractViewHelper
27
{
28
    /**
29
     * @var boolean
30
     */
31
    protected $escapeChildren = false;
32

33
    /**
34
     * @var boolean
35
     */
36
    protected $escapeOutput = false;
37

38
    public function initializeArguments(): void
39
    {
40
        $this->registerArgument('name', 'string', 'Name of register');
3✔
41
    }
42

43
    /**
44
     * @return mixed
45
     */
46
    public static function renderStatic(
47
        array $arguments,
48
        \Closure $renderChildrenClosure,
49
        RenderingContextInterface $renderingContext
50
    ) {
51
        /** @var string $name */
52
        $name = $arguments['name'] ?? $renderChildrenClosure();
3✔
53
        if (!($GLOBALS['TSFE'] ?? null) instanceof TypoScriptFrontendController) {
3✔
54
            return null;
×
55
        }
56
        return $GLOBALS['TSFE']->register[$name] ?? null;
3✔
57
    }
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc