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

FluidTYPO3 / flux / 12237686280

09 Dec 2024 02:27PM UTC coverage: 92.9% (-0.5%) from 93.421%
12237686280

push

github

NamelessCoder
[TER] 10.1.0

7013 of 7549 relevant lines covered (92.9%)

56.22 hits per line

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

92.86
/Classes/ViewHelpers/Form/VariableViewHelper.php
1
<?php
2
declare(strict_types=1);
3
namespace FluidTYPO3\Flux\ViewHelpers\Form;
4

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

12
use FluidTYPO3\Flux\ViewHelpers\AbstractFormViewHelper;
13
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
14

15
/**
16
 * Sets an option in the Form instance
17
 */
18
class VariableViewHelper extends AbstractFormViewHelper
19
{
20
    public function initializeArguments(): void
21
    {
22
        $this->registerArgument('value', 'mixed', 'Value of the option');
6✔
23
        $this->registerArgument(
6✔
24
            'name',
6✔
25
            'string',
6✔
26
            'Name of the option - valid values and their behaviours depend entirely on the consumer that will ' .
6✔
27
            'handle the Form instance',
6✔
28
            true
6✔
29
        );
6✔
30
    }
31

32
    public function render()
33
    {
34
        return self::renderStatic($this->arguments, $this->buildRenderChildrenClosure(), $this->renderingContext);
×
35
    }
36

37
    public static function renderStatic(
38
        array $arguments,
39
        \Closure $renderChildrenClosure,
40
        RenderingContextInterface $renderingContext
41
    ): string {
42
        /** @var string $variableName */
43
        $variableName = $arguments['name'];
6✔
44
        static::getContainerFromRenderingContext($renderingContext)
6✔
45
            ->setVariable($variableName, $arguments['value'] ?? $renderChildrenClosure());
6✔
46
        return '';
6✔
47
    }
48

49
    public function getContentArgumentName(): ?string
50
    {
51
        return 'value';
4✔
52
    }
53
}
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