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

CPS-IT / handlebars-forms / 22296296773

23 Feb 2026 07:10AM UTC coverage: 0.0%. First build
22296296773

push

github

eliashaeussler
Initial commit

0 of 447 new or added lines in 21 files covered. (0.0%)

0 of 447 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/NavigationValueProcessor.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 CPSIT\Typo3HandlebarsForms\Fluid\ViewHelperInvoker;
22
use TYPO3\CMS\Fluid;
23
use TYPO3\CMS\Form;
24

25
/**
26
 * NavigationValueProcessor
27
 *
28
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
29
 * @license GPL-2.0-or-later
30
 */
31
final readonly class NavigationValueProcessor implements ValueProcessor
32
{
NEW
33
    public function __construct(
×
34
        private ViewHelperInvoker $viewHelperInvoker,
NEW
35
    ) {}
×
36

37
    /**
38
     * @return list<NavigationElement>
39
     */
NEW
40
    public function process(
×
41
        Form\Domain\Model\Renderable\RootRenderableInterface $renderable,
42
        DataProcessing\Renderable\ProcessedRenderable $processedRenderable,
43
        array $configuration = [],
44
    ): array {
NEW
45
        $navigationElements = [];
×
NEW
46
        $renderables = [];
×
47

48
        // We cannot process navigation within a concrete form element
NEW
49
        if (!($renderable instanceof Form\Domain\Runtime\FormRuntime)) {
×
NEW
50
            return [];
×
51
        }
52

NEW
53
        if ($renderable->getPreviousPage() !== null) {
×
NEW
54
            $renderables['previousPage'] = $renderable->getPreviousPage();
×
55
        }
56

NEW
57
        if ($renderable->getNextPage() !== null) {
×
NEW
58
            $renderables['nextPage'] = $renderable->getNextPage();
×
59
        } else {
NEW
60
            $renderables['submit'] = $renderable;
×
61
        }
62

NEW
63
        foreach ($renderables as $step => $pageOrForm) {
×
NEW
64
            $stepConfiguration = $configuration[$step . '.'] ?? null;
×
NEW
65
            $isPage = $pageOrForm instanceof Form\Domain\Model\FormElements\Page;
×
66

NEW
67
            if (is_array($stepConfiguration)) {
×
NEW
68
                $buttonResult = $this->viewHelperInvoker->invoke(
×
NEW
69
                    $processedRenderable->renderingContext,
×
NEW
70
                    Fluid\ViewHelpers\Form\ButtonViewHelper::class,
×
NEW
71
                    [
×
NEW
72
                        'property' => '__currentPage',
×
NEW
73
                        'value' => $isPage ? $pageOrForm->getIndex() : count($pageOrForm->getPages()),
×
NEW
74
                    ],
×
NEW
75
                );
×
76

NEW
77
                $labelResult = $this->viewHelperInvoker->invoke(
×
NEW
78
                    $processedRenderable->renderingContext,
×
NEW
79
                    Form\ViewHelpers\TranslateElementPropertyViewHelper::class,
×
NEW
80
                    [
×
NEW
81
                        'element' => $isPage ? $renderable->getCurrentPage() : $renderable,
×
NEW
82
                        'renderingOptionProperty' => match ($step) {
×
NEW
83
                            'previousPage' => 'previousButtonLabel',
×
NEW
84
                            'nextPage' => 'nextButtonLabel',
×
NEW
85
                            'submit' => 'submitButtonLabel',
×
NEW
86
                        },
×
NEW
87
                    ],
×
NEW
88
                );
×
89

NEW
90
                $buttonResult->tag->addAttribute('label', $labelResult->content);
×
91

NEW
92
                $navigationElements[] = new NavigationElement(
×
NEW
93
                    $pageOrForm,
×
NEW
94
                    new DataProcessing\Renderable\ProcessedRenderable(
×
NEW
95
                        $processedRenderable->renderingContext,
×
NEW
96
                        $buttonResult->tag,
×
NEW
97
                        $buttonResult->content,
×
NEW
98
                    ),
×
NEW
99
                    $stepConfiguration,
×
NEW
100
                );
×
101
            } else {
NEW
102
                $navigationElements[] = new NavigationElement(
×
NEW
103
                    $pageOrForm,
×
NEW
104
                    new DataProcessing\Renderable\ProcessedRenderable($processedRenderable->renderingContext, null),
×
NEW
105
                );
×
106
            }
107
        }
108

NEW
109
        return $navigationElements;
×
110
    }
111

NEW
112
    public static function getName(): string
×
113
    {
NEW
114
        return 'NAVIGATION';
×
115
    }
116
}
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