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

FluidTYPO3 / flux / 27757675993

18 Jun 2026 11:55AM UTC coverage: 89.162% (-3.5%) from 92.646%
27757675993

push

github

NamelessCoder
[TASK] Address last phpstan warnings

6228 of 6985 relevant lines covered (89.16%)

40.84 hits per line

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

98.59
/Classes/ViewHelpers/FieldViewHelper.php
1
<?php
2
namespace FluidTYPO3\Flux\ViewHelpers;
3

4
/*
5
 * This file is part of the FluidTYPO3/Flux 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\Flux\Form\Field;
12
use FluidTYPO3\Flux\Form\FieldContainerInterface;
13
use FluidTYPO3\Flux\Form\FieldInterface;
14
use FluidTYPO3\Flux\ViewHelpers\Field\AbstractFieldViewHelper;
15
use TYPO3Fluid\Fluid\Component\Argument\ArgumentCollection;
16
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
17

18
/**
19
 * FlexForm field ViewHelper
20
 *
21
 * Defines a single field data structure.
22
 */
23
class FieldViewHelper extends AbstractFieldViewHelper
24
{
25
    public function initializeArguments(): void
26
    {
27
        $this->registerArgument('type', 'string', 'TCA field type', true);
4✔
28
        $this->registerArgument('name', 'string', 'Name of the attribute, FlexForm XML-valid tag name string', true);
4✔
29
        $this->registerArgument('label', 'string', 'Label for field');
4✔
30
        $this->registerArgument('description', 'string', 'Field description', false);
4✔
31
        $this->registerArgument('exclude', 'bool', 'Set to FALSE if field is not an "exclude" field', false, false);
4✔
32
        $this->registerArgument('config', 'array', 'TCA "config" array', false, []);
4✔
33
        $this->registerArgument(
4✔
34
            'transform',
4✔
35
            'string',
4✔
36
            'Set this to transform your value to this type - integer, array (for csv values), float, DateTime, ' .
4✔
37
            'Vendor\\MyExt\\Domain\\Model\\Object or ObjectStorage with type hint.'
4✔
38
        );
4✔
39
        $this->registerArgument(
4✔
40
            'onChange',
4✔
41
            'string',
4✔
42
            'TCA onChange instruction',
4✔
43
            false
4✔
44
        );
4✔
45
        $this->registerArgument(
4✔
46
            'displayCond',
4✔
47
            'string',
4✔
48
            'Optional "Display Condition" (TCA style) for this particular field. See: ' .
4✔
49
            'https://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Index.html#displaycond'
4✔
50
        );
4✔
51
        $this->registerArgument(
4✔
52
            'inherit',
4✔
53
            'boolean',
4✔
54
            'If TRUE, the value for this particular field is inherited - if inheritance is enabled by ' .
4✔
55
            'the ConfigurationProvider',
4✔
56
            false,
4✔
57
            true
4✔
58
        );
4✔
59
        $this->registerArgument(
4✔
60
            'inheritEmpty',
4✔
61
            'boolean',
4✔
62
            'If TRUE, allows empty values (specifically excluding the number zero!) to be inherited - if inheritance ' .
4✔
63
            'is enabled by the ConfigurationProvider',
4✔
64
            false,
4✔
65
            true
4✔
66
        );
4✔
67
        $this->registerArgument(
4✔
68
            'clear',
4✔
69
            'boolean',
4✔
70
            'If TRUE, a "clear value" checkbox is displayed next to the field which when checked, completely ' .
4✔
71
            'destroys the current field value all the way down to the stored XML value.',
4✔
72
            false,
4✔
73
            false
4✔
74
        );
4✔
75
        $this->registerArgument(
4✔
76
            'protect',
4✔
77
            'boolean',
4✔
78
            'If TRUE, a "protect value" checkbox is displayed next to the field which when checked, protects the ' .
4✔
79
            'value from being changed if the (normally inherited) field value is changed in a parent record. Has no ' .
4✔
80
            'effect if "inherit" is disabled on the field.',
4✔
81
            false,
4✔
82
            false
4✔
83
        );
4✔
84
        $this->registerArgument(
4✔
85
            'extensionName',
4✔
86
            'string',
4✔
87
            'If provided, enables overriding the extension context for this and all child nodes. The extension name ' .
4✔
88
            'is otherwise automatically detected from rendering context.'
4✔
89
        );
4✔
90
    }
91

92
    public static function getComponent(
93
        RenderingContextInterface $renderingContext,
94
        iterable $arguments
95
    ): FieldInterface {
96
        /** @var array $arguments */
97
        $parent = static::getContainerFromRenderingContext($renderingContext);
12✔
98
        $field = Field::create($arguments instanceof ArgumentCollection ? $arguments->getArrayCopy() : $arguments);
12✔
99
        $field->setClearable($arguments['clear']);
12✔
100
        $field->setProtectable($arguments['protect']);
12✔
101

102
        if (!$parent instanceof FieldContainerInterface) {
12✔
103
            return $field;
×
104
        }
105

106
        $parent->add($field);
12✔
107
        return $field;
12✔
108
    }
109
}
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