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

TYPO3-Headless / headless / 14022693367

23 Mar 2025 08:26PM UTC coverage: 52.345% (-20.8%) from 73.13%
14022693367

Pull #815

github

web-flow
Merge e0fcdaa4a into a15e1c8c4
Pull Request #815: [FEATURE] Add support for f:form.* viewhelper

0 of 600 new or added lines in 15 files covered. (0.0%)

1105 of 2111 relevant lines covered (52.34%)

5.94 hits per line

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

0.0
/Classes/XClass/ViewHelpers/Form/TextareaViewHelper.php
1
<?php
2

3
/*
4
 * This file is part of the "headless" Extension for TYPO3 CMS.
5
 *
6
 * For the full copyright and license information, please read the
7
 * LICENSE.md file that was distributed with this source code.
8
 */
9

10
declare(strict_types=1);
11

12
/*
13
 * This file is part of the TYPO3 CMS project.
14
 *
15
 * It is free software; you can redistribute it and/or modify it under
16
 * the terms of the GNU General Public License, either version 2
17
 * of the License, or any later version.
18
 *
19
 * For the full copyright and license information, please read the
20
 * LICENSE.txt file that was distributed with this source code.
21
 *
22
 * The TYPO3 project - inspiring people to share!
23
 */
24

25
namespace FriendsOfTYPO3\Headless\XClass\ViewHelpers\Form;
26

27
/**
28
 * Generates an :html:`<textarea>`.
29
 *
30
 * The value of the text area needs to be set via the ``value`` attribute, as with all other form ViewHelpers.
31
 *
32
 * Examples
33
 * ========
34
 *
35
 * Example::
36
 *
37
 *    <f:form.textarea name="myTextArea" value="This is shown inside the textarea" />
38
 *
39
 * Output::
40
 *
41
 *    {
42
 *      "name": "tx_extension_plugin[myTextArea]",
43
 *      "type": "textarea",
44
 *      "value": "This is shown inside the textarea"
45
 *    }
46
 */
47
final class TextareaViewHelper extends AbstractFormFieldViewHelper
48
{
49
    public function initializeArguments(): void
50
    {
NEW
51
        parent::initializeArguments();
×
NEW
52
        $this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this ViewHelper', false, 'f3-form-error');
×
NEW
53
        $this->registerArgument('required', 'bool', 'Specifies whether the textarea is required', false, false);
×
54
    }
55

56
    public function render(): string
57
    {
NEW
58
        $this->data = json_decode(parent::render(), true);
×
59

NEW
60
        $required = $this->arguments['required'];
×
NEW
61
        $name = $this->getName();
×
NEW
62
        $this->registerFieldNameForFormTokenGeneration($name);
×
NEW
63
        $this->setRespectSubmittedDataValue(true);
×
64

NEW
65
        $this->data['name'] = $name;
×
NEW
66
        $this->data['type'] = 'textarea';
×
NEW
67
        if ($required === true) {
×
NEW
68
            $this->data['required'] = 'required';
×
69
        }
70

NEW
71
        $this->data['value'] = htmlspecialchars((string)$this->getValueAttribute());
×
NEW
72
        $this->addAdditionalIdentityPropertiesIfNeeded();
×
NEW
73
        $this->setErrorClassAttribute();
×
74

NEW
75
        return json_encode($this->data);
×
76
    }
77
}
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