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

CPS-IT / handlebars-forms / 23788341707

31 Mar 2026 08:38AM UTC coverage: 0.662% (-0.06%) from 0.726%
23788341707

Pull #18

github

web-flow
Merge 8a82cc501 into 6df75c1eb
Pull Request #18: feature/view models

0 of 178 new or added lines in 32 files covered. (0.0%)

7 of 1058 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/TagContentObject.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 DevTheorem\Handlebars;
22
use Symfony\Component\DependencyInjection;
23

24
/**
25
 * TagContentObject
26
 *
27
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
28
 * @license GPL-2.0-or-later
29
 */
30
#[DependencyInjection\Attribute\AutoconfigureTag('frontend.contentobject', ['identifier' => 'HBS_TAG'])]
31
final class TagContentObject extends AbstractHandlebarsFormsContentObject
32
{
33
    protected function resolve(array $configuration, Context\ValueResolutionContext $context): ?Handlebars\SafeString
×
34
    {
NEW
35
        if (!($context->viewModel instanceof Domain\ViewModel\TagAwareViewModel)) {
×
NEW
36
            return null;
×
37
        }
38

NEW
39
        $tag = $context->viewModel->getTag();
×
40

41
        if (!array_key_exists('attribute', $configuration)) {
×
NEW
42
            return $this->safeString($tag->getContent());
×
43
        }
44

45
        $attributeName = $configuration['attribute'] ?? null;
×
46

47
        if (!is_string($attributeName)) {
×
48
            return null;
×
49
        }
50

NEW
51
        return $this->safeString($tag->getAttribute($attributeName));
×
52
    }
53

54
    private function safeString(?string $content): ?Handlebars\SafeString
×
55
    {
56
        if ($content === null) {
×
57
            return null;
×
58
        }
59

60
        return new Handlebars\SafeString($content);
×
61
    }
62
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc