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

FluidTYPO3 / flux / 14774311267

01 May 2025 11:00AM UTC coverage: 93.246% (+0.3%) from 92.9%
14774311267

push

github

NamelessCoder
[TER] 11.0.0

7083 of 7596 relevant lines covered (93.25%)

66.31 hits per line

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

95.24
/Classes/Integration/HookSubscribers/DynamicFlexForm.php
1
<?php
2
namespace FluidTYPO3\Flux\Integration\HookSubscribers;
3

4
/*
5
 * This file is part of the FluidTYPO3/Flux project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use FluidTYPO3\Flux\Builder\FlexFormBuilder;
12
use FluidTYPO3\Flux\Proxy\FlexFormToolsProxy;
13

14
class DynamicFlexForm
15
{
16
    protected FlexFormBuilder $flexFormBuilder;
17
    protected FlexFormToolsProxy $flexFormTools;
18

19
    protected static bool $recursed = false;
20

21
    public function __construct(FlexFormBuilder $flexFormBuilder, FlexFormToolsProxy $flexFormTools)
22
    {
23
        $this->flexFormBuilder = $flexFormBuilder;
21✔
24
        $this->flexFormTools = $flexFormTools;
21✔
25
    }
26

27
    /**
28
     * Method to generate a custom identifier for a Flux-based DS.
29
     * The custom identifier must include a record ID, which we
30
     * can then use to restore the record.
31
     */
32
    public function getDataStructureIdentifierPreProcess(
33
        array $tca,
34
        string $tableName,
35
        string $fieldName,
36
        array $record
37
    ): array {
38
        if (static::$recursed) {
7✔
39
            return [];
×
40
        }
41
        static::$recursed = true;
7✔
42
        /** @var string|array $originalIdentifier */
43
        $originalIdentifier = $this->flexFormTools->getDataStructureIdentifier(
7✔
44
            [ 'config' => $GLOBALS['TCA'][$tableName]['columns'][$fieldName]['config']],
7✔
45
            $tableName,
7✔
46
            $fieldName,
7✔
47
            $record
7✔
48
        );
7✔
49
        static::$recursed = false;
7✔
50
        if (is_string($originalIdentifier)) {
7✔
51
            /** @var array $originalIdentifier */
52
            $originalIdentifier = json_decode($originalIdentifier, true);
7✔
53
        }
54
        return $this->flexFormBuilder->resolveDataStructureIdentifier(
7✔
55
            $tableName,
7✔
56
            $fieldName,
7✔
57
            $record,
7✔
58
            $originalIdentifier
7✔
59
        );
7✔
60
    }
61

62
    public function parseDataStructureByIdentifierPreProcess(array $identifier): array
63
    {
64
        return $this->flexFormBuilder->parseDataStructureByIdentifier($identifier);
7✔
65
    }
66
}
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