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

CPS-IT / handlebars-forms / 23788866234

31 Mar 2026 08:52AM UTC coverage: 0.659% (-0.06%) from 0.72%
23788866234

push

github

web-flow
Merge pull request #18 from CPS-IT/feature/view-models

0 of 163 new or added lines in 33 files covered. (0.0%)

7 of 1062 relevant lines covered (0.66%)

0.03 hits per line

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

0.0
/Classes/ContentObject/ChildrenContentObject.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\Domain;
21
use Symfony\Component\DependencyInjection;
22

23
/**
24
 * ChildrenContentObject
25
 *
26
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
27
 * @license GPL-2.0-or-later
28
 */
29
#[DependencyInjection\Attribute\AutoconfigureTag('frontend.contentobject', ['identifier' => 'HBS_CHILDREN'])]
30
final class ChildrenContentObject extends AbstractHandlebarsFormsContentObject
31
{
32
    private const CHILD_INDEX_IDENTIFIER = '_currentChildIndex';
33

34
    /**
35
     * @return list<mixed>|null
36
     */
37
    protected function resolve(array $configuration, Context\ValueResolutionContext $context): ?array
×
38
    {
NEW
39
        if (!($context->viewModel instanceof Domain\ViewModel\CompositeViewModel)) {
×
NEW
40
            return null;
×
41
        }
42

NEW
43
        $children = $context->viewModel->getChildren();
×
44

45
        if ($children === []) {
×
46
            return null;
×
47
        }
48

49
        $processedValue = [];
×
50

51
        foreach ($children as $index => $childViewModel) {
×
52
            if ($this->cObj !== null) {
×
53
                $this->cObj->data[self::CHILD_INDEX_IDENTIFIER] = $index;
×
54
            }
55

56
            try {
57
                $processedValue[] = $context->process($configuration, viewModel: $childViewModel);
×
58
            } finally {
59
                if ($this->cObj !== null) {
×
60
                    unset($this->cObj->data[self::CHILD_INDEX_IDENTIFIER]);
×
61
                }
62
            }
63
        }
64

65
        return $processedValue;
×
66
    }
67
}
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