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

CPS-IT / handlebars-forms / 23294489338

19 Mar 2026 12:18PM UTC coverage: 0.0%. Remained the same
23294489338

push

github

eliashaeussler
[FEATURE] Populate current index when iterating children and renderables

0 of 12 new or added lines in 2 files covered. (0.0%)

34 existing lines in 2 files now uncovered.

0 of 841 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/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 Symfony\Component\DependencyInjection;
21

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

33
    /**
34
     * @return list<mixed>|null
35
     */
36
    protected function resolve(array $configuration, Context\ValueResolutionContext $context): ?array
×
37
    {
38
        $children = $context->viewModel->children;
×
39

40
        if ($children === []) {
×
41
            return null;
×
42
        }
43

44
        $processedValue = [];
×
45

NEW
46
        foreach ($children as $index => $childViewModel) {
×
NEW
47
            if ($this->cObj !== null) {
×
NEW
48
                $this->cObj->data[self::CHILD_INDEX_IDENTIFIER] = $index;
×
49
            }
50

51
            try {
NEW
52
                $processedValue[] = $context->process($configuration, viewModel: $childViewModel);
×
53
            } finally {
NEW
54
                if ($this->cObj !== null) {
×
NEW
55
                    unset($this->cObj->data[self::CHILD_INDEX_IDENTIFIER]);
×
56
                }
57
            }
58
        }
59

60
        return $processedValue;
×
61
    }
62
}
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