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

FluidTYPO3 / flux / 18588861398

17 Oct 2025 09:40AM UTC coverage: 92.656% (-0.1%) from 92.767%
18588861398

push

github

NamelessCoder
[TER] 11.1.0

7090 of 7652 relevant lines covered (92.66%)

66.89 hits per line

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

97.44
/Classes/Integration/FormEngine/ProviderProcessor.php
1
<?php
2
namespace FluidTYPO3\Flux\Integration\FormEngine;
3

4
use FluidTYPO3\Flux\Content\ContentTypeManager;
5
use FluidTYPO3\Flux\Provider\Interfaces\DataStructureProviderInterface;
6
use FluidTYPO3\Flux\Provider\ProviderResolver;
7
use FluidTYPO3\Flux\Proxy\SiteFinderProxy;
8
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
9
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
10
use TYPO3\CMS\Core\Utility\GeneralUtility;
11

12
class ProviderProcessor implements FormDataProviderInterface
13
{
14
    private ProviderResolver $resolver;
15
    private ContentTypeManager $contentTypeManager;
16
    private SiteFinderProxy $siteFinder;
17

18
    public function __construct(
19
        ProviderResolver $resolver,
20
        ContentTypeManager $contentTypeManager,
21
        SiteFinderProxy $siteFinder
22
    ) {
23
        $this->resolver = $resolver;
42✔
24
        $this->contentTypeManager = $contentTypeManager;
42✔
25
        $this->siteFinder = $siteFinder;
42✔
26
    }
27

28
    public function addData(array $result): array
29
    {
30
        if (!isset($result['tableName'])) {
42✔
31
            throw new \UnexpectedValueException('Input data requires a "tableName" property', 1666816552);
7✔
32
        }
33
        if (!isset($result['databaseRow'])) {
35✔
34
            throw new \UnexpectedValueException('Input data requires a "databaseRow" property', 1666816552);
7✔
35
        }
36
        if ($result['tableName'] === 'tt_content') {
28✔
37
            $pageUid = $result['parentPageRow']['uid'];
21✔
38
            if ($pageUid > 0) {
21✔
39
                $enabledContentTypes = [];
21✔
40
                try {
41
                    $site = $this->siteFinder->getSiteByPageId($pageUid);
21✔
42
                    $siteConfiguration = $site->getConfiguration();
7✔
43
                    if (is_array($siteConfiguration['flux_content_types'] ?? null)) {
7✔
44
                        $enabledContentTypes = $siteConfiguration['flux_content_types'];
×
45
                    } else {
46
                        $enabledContentTypes = GeneralUtility::trimExplode(
7✔
47
                            ',',
7✔
48
                            $siteConfiguration['flux_content_types'] ?? '',
7✔
49
                            true
7✔
50
                        );
7✔
51
                    }
52
                } catch (SiteNotFoundException $exception) {
14✔
53
                    // Suppressed; sites not being found isn't a fatal problem here.
54
                }
55
                if (!empty($enabledContentTypes)) {
21✔
56
                    $fluidContentTypeNames = (array) $this->contentTypeManager->fetchContentTypeNames();
7✔
57
                    $currentItems = $result['processedTca']['columns']['CType']['config']['items'];
7✔
58
                    foreach ($currentItems as $index => $optionArray) {
7✔
59
                        $contentTypeName = $optionArray['value'] ?? $optionArray[1];
7✔
60
                        if (in_array($contentTypeName, $fluidContentTypeNames, true)
7✔
61
                            && !in_array($contentTypeName, $enabledContentTypes, true)
7✔
62
                        ) {
63
                            unset($result['processedTca']['columns']['CType']['config']['items'][$index]);
7✔
64
                        }
65
                    }
66
                }
67
            }
68
        }
69

70
        /** @var DataStructureProviderInterface[] $providers */
71
        $providers = $this->resolver->resolveConfigurationProviders(
28✔
72
            $result['tableName'],
28✔
73
            null,
28✔
74
            $result['databaseRow'],
28✔
75
            null,
28✔
76
            [DataStructureProviderInterface::class]
28✔
77
        );
28✔
78
        foreach ($providers as $provider) {
28✔
79
            $result = $provider->processTableConfiguration($result['databaseRow'], $result);
28✔
80
        }
81
        return $result;
28✔
82
    }
83
}
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