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

CPS-IT / handlebars-forms / 23345487403

20 Mar 2026 01:41PM UTC coverage: 0.0%. Remained the same
23345487403

Pull #13

github

web-flow
Merge a50d45f0f into 280f55e6d
Pull Request #13: [FEATURE] Introduce `HBS_TRANSLATE_ERROR` content object

0 of 17 new or added lines in 1 file covered. (0.0%)

0 of 858 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/Classes/ContentObject/TranslateErrorContentObject.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "handlebars_forms".
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17

18
namespace CPSIT\Typo3HandlebarsForms\ContentObject;
19

20
use CPSIT\Typo3HandlebarsForms\Fluid;
21
use Symfony\Component\DependencyInjection;
22
use TYPO3\CMS\Extbase;
23
use TYPO3\CMS\Form;
24

25
/**
26
 * TranslateErrorContentObject
27
 *
28
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
29
 * @license GPL-2.0-or-later
30
 */
31
#[DependencyInjection\Attribute\AutoconfigureTag('frontend.contentobject', ['identifier' => 'HBS_TRANSLATE_ERROR'])]
32
final class TranslateErrorContentObject extends AbstractHandlebarsFormsContentObject
33
{
NEW
34
    public function __construct(
×
35
        private readonly Fluid\ViewHelperInvoker $viewHelperInvoker,
NEW
36
    ) {}
×
37

NEW
38
    protected function resolve(array $configuration, Context\ValueResolutionContext $context): mixed
×
39
    {
NEW
40
        $errorCode = $configuration['error'] ?? null;
×
NEW
41
        $default = $configuration['default'] ?? null;
×
42

NEW
43
        if (!is_numeric($errorCode)) {
×
NEW
44
            return null;
×
45
        }
46

NEW
47
        if (!is_string($default)) {
×
NEW
48
            $default = '';
×
49
        }
50

NEW
51
        return $this->viewHelperInvoker->invoke(
×
NEW
52
            $context->viewModel->renderingContext,
×
NEW
53
            Form\ViewHelpers\TranslateElementErrorViewHelper::class,
×
NEW
54
            [
×
NEW
55
                'element' => $context->renderable,
×
NEW
56
                'error' => new Extbase\Error\Error($default, (int)$errorCode),
×
NEW
57
            ],
×
NEW
58
        )->content;
×
59
    }
60
}
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