• 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

93.33
/Classes/ViewHelpers/Resource/FileViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Resource;
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\Traits\TemplateVariableViewHelperTrait;
12

13
/**
14
 * ViewHelper to output or assign FAL sys_file records.
15
 */
16
class FileViewHelper extends AbstractResourceViewHelper
17
{
18
    use TemplateVariableViewHelperTrait;
19

20
    public function initializeArguments(): void
21
    {
22
        parent::initializeArguments();
3✔
23
        $this->registerAsArgument();
3✔
24
        $this->registerArgument(
3✔
25
            'onlyProperties',
3✔
26
            'boolean',
3✔
27
            'Whether to return only the properties array of the sys_file record and not the File object itself',
3✔
28
            false,
3✔
29
            true
3✔
30
        );
3✔
31
    }
32

33
    public function render(): string
34
    {
35
        /** @var boolean $onlyProperties */
36
        $onlyProperties = $this->arguments['onlyProperties'];
3✔
37
        $files = (array) $this->getFiles($onlyProperties);
3✔
38
        if (1 === count($files)) {
3✔
39
            $files = array_shift($files);
×
40
        }
41
        // @TODO: figure out how to allow a ViewHelper to both render tags or return objects
42
        $output = $this->renderChildrenWithVariableOrReturnInput($files);
3✔
43
        return is_scalar($output) ? (string) $output : '';
3✔
44
    }
45
}
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