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

CPS-IT / handlebars-forms / 22340200704

24 Feb 2026 07:00AM UTC coverage: 0.0%. Remained the same
22340200704

push

github

eliashaeussler
[TASK] Improve namings and extract RENDERABLES to its own value processor

0 of 129 new or added lines in 18 files covered. (0.0%)

3 existing lines in 2 files now uncovered.

0 of 458 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/DataProcessing/Value/RenderablesValueProcessor.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\DataProcessing\Value;
19

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

25
/**
26
 * RenderablesValueProcessor
27
 *
28
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
29
 * @license GPL-2.0-or-later
30
 */
31
final readonly class RenderablesValueProcessor implements ValueProcessor
32
{
33
    /**
34
     * @param iterable<DataProcessing\Renderable\RenderableProcessor<Form\Domain\Model\Renderable\RootRenderableInterface>> $renderableProcessors
35
     */
NEW
36
    public function __construct(
×
37
        #[DependencyInjection\Attribute\AutowireIterator('handlebars_forms.renderable_processor')]
38
        private iterable $renderableProcessors,
NEW
39
    ) {}
×
40

41
    /**
42
     * @return list<mixed>
43
     */
NEW
44
    public function process(
×
45
        Form\Domain\Model\Renderable\RootRenderableInterface $renderable,
46
        DataProcessing\Renderable\RenderableViewModel $viewModel,
47
        ProcessingContext $context = new ProcessingContext(),
48
    ): array {
NEW
49
        $processedRenderables = [];
×
50

NEW
51
        if ($renderable instanceof Form\Domain\Runtime\FormRuntime) {
×
NEW
52
            $renderables = $renderable->getCurrentPage()?->getRenderablesRecursively() ?? [];
×
NEW
53
        } elseif ($renderable instanceof Form\Domain\Model\Renderable\CompositeRenderableInterface) {
×
NEW
54
            $renderables = $renderable->getRenderablesRecursively();
×
55
        } else {
56
            // We cannot process non-composite renderables here
NEW
57
            return [];
×
58
        }
59

NEW
60
        foreach ($renderables as $child) {
×
NEW
61
            $childConfiguration = $context[$child->getType() . '.'];
×
62

NEW
63
            if (is_array($childConfiguration)) {
×
NEW
64
                $childViewModel = $this->buildFormProperties($child, $viewModel->renderingContext);
×
65
            } else {
NEW
66
                $childConfiguration = [];
×
NEW
67
                $childViewModel = new DataProcessing\Renderable\RenderableViewModel($viewModel->renderingContext, null);
×
68
            }
69

NEW
70
            $processedChild = $context->process($childConfiguration, $child, $childViewModel);
×
71

NEW
72
            if ($processedChild !== null) {
×
NEW
73
                $processedRenderables[] = $processedChild;
×
74
            }
75
        }
76

NEW
77
        return $processedRenderables;
×
78
    }
79

NEW
80
    private function buildFormProperties(
×
81
        Form\Domain\Model\Renderable\RootRenderableInterface $renderable,
82
        Fluid\Core\Rendering\RenderingContext $renderingContext,
83
    ): DataProcessing\Renderable\RenderableViewModel {
NEW
84
        foreach ($this->renderableProcessors as $renderableProcessor) {
×
NEW
85
            if ($renderableProcessor->supports($renderable)) {
×
NEW
86
                return $renderableProcessor->process($renderable, $renderingContext);
×
87
            }
88
        }
89

NEW
90
        return new DataProcessing\Renderable\RenderableViewModel($renderingContext, null);
×
91
    }
92

NEW
93
    public static function getName(): string
×
94
    {
NEW
95
        return 'RENDERABLES';
×
96
    }
97
}
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