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

FluidTYPO3 / vhs / 28590230059

02 Jul 2026 12:32PM UTC coverage: 70.857%. First build
28590230059

push

github

NamelessCoder
[TASK] Migrate View-operating code to predictable View type

18 of 24 new or added lines in 4 files covered. (75.0%)

4853 of 6849 relevant lines covered (70.86%)

4.46 hits per line

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

52.94
/Classes/ViewHelpers/Render/InlineViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Render;
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 TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
12

13
/**
14
 * ### Render: Inline
15
 *
16
 * Render as string containing Fluid as if it were
17
 * part of the template currently being rendered.
18
 *
19
 * Environment (template variables etc.) is cloned
20
 * but not re-merged after rendering, which means that
21
 * any and all changes in variables that happen while
22
 * rendering this inline code will be destroyed after
23
 * sub-rendering is finished.
24
 */
25
class InlineViewHelper extends AbstractRenderViewHelper
26
{
27
    /**
28
     * @var boolean
29
     */
30
    protected $escapeChildren = false;
31

32
    public function initializeArguments(): void
33
    {
34
        $this->registerArgument('content', 'string', 'Template code to render as Fluid (usually from a variable)');
2✔
35
        $this->registerArgument(
2✔
36
            'namespaces',
2✔
37
            'array',
2✔
38
            'Optional additional/overridden namespaces, ["ns" => "MyVendor\\MyExt\\ViewHelpers"]',
2✔
39
            false,
2✔
40
            []
2✔
41
        );
2✔
42
        parent::initializeArguments();
2✔
43
    }
44

45
    /**
46
     * @return string
47
     */
48
    public static function renderStatic(
49
        array $arguments,
50
        \Closure $renderChildrenClosure,
51
        RenderingContextInterface $renderingContext
52
    ) {
53
        /** @var string $content */
54
        $content = $arguments['content'] ?? $renderChildrenClosure();
×
55
        $namespaces = static::getPreparedNamespaces($arguments);
×
56
        $namespaceHeader = implode(PHP_EOL, $namespaces);
×
57
        foreach ($namespaces as $namespace) {
×
58
            $content = str_replace($namespace, '', $content);
×
59
        }
60
        $view = static::getPreparedClonedView($renderingContext);
×
NEW
61
        $view->getRenderingContext()->getTemplatePaths()->setTemplateSource($namespaceHeader . $content);
×
62
        return static::renderView($view, $arguments);
×
63
    }
64
}
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