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

FluidTYPO3 / flux / 17367842189

30 Aug 2025 01:18PM UTC coverage: 93.2% (-0.01%) from 93.211%
17367842189

push

github

web-flow
[BUGFIX] Fix error due to undefined array key "colPos" in colPosListItemProcFunc (#2254)

When viewing the history in TYPO3 backend, colPosListItemProcFunc is called with parameters that don't include "colPos". Trying to calculate the parent uid caused an error in these cases.

Co-authored-by: Claus Due <claus@namelesscoder.net>

1 of 2 new or added lines in 1 file covered. (50.0%)

7086 of 7603 relevant lines covered (93.2%)

66.26 hits per line

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

96.15
/Classes/Integration/HookSubscribers/ColumnPositionItems.php
1
<?php
2

3
namespace FluidTYPO3\Flux\Integration\HookSubscribers;
4

5
use FluidTYPO3\Flux\Integration\FormEngine\SelectOption;
6
use FluidTYPO3\Flux\Provider\Interfaces\GridProviderInterface;
7
use FluidTYPO3\Flux\Provider\ProviderResolver;
8
use FluidTYPO3\Flux\Service\WorkspacesAwareRecordService;
9
use FluidTYPO3\Flux\Utility\ColumnNumberUtility;
10
use TYPO3\CMS\Core\Utility\GeneralUtility;
11

12
class ColumnPositionItems
13
{
14
    private WorkspacesAwareRecordService $recordService;
15
    private ProviderResolver $providerResolver;
16

17
    public function __construct(WorkspacesAwareRecordService $recordService, ProviderResolver $providerResolver)
18
    {
19
        $this->recordService = $recordService;
28✔
20
        $this->providerResolver = $providerResolver;
28✔
21
    }
22

23
    /**
24
     * Gets colPos items to be shown in the forms engine.
25
     * This method is called as "itemsProcFunc" with the accordant context
26
     * for tt_content.colPos.
27
     */
28
    public function colPosListItemProcFunc(array &$parameters): void
29
    {
30
        if (!isset($parameters['row']['colPos'])) {
28✔
NEW
31
            return;
×
32
        }
33
        $parentRecordUid = ColumnNumberUtility::calculateParentUid($parameters['row']['colPos']);
28✔
34
        $parentRecord = $this->recordService->getSingle('tt_content', '*', $parentRecordUid);
28✔
35
        $provider = $this->providerResolver->resolvePrimaryConfigurationProvider('tt_content', null, $parentRecord);
28✔
36
        if ($parentRecord && $provider instanceof GridProviderInterface) {
28✔
37
            $grid = $provider->getGrid($parentRecord);
7✔
38
            /** @var SelectOption $dividerItem */
39
            $dividerItem = GeneralUtility::makeInstance(
7✔
40
                SelectOption::class,
7✔
41
                'LLL:EXT:flux/Resources/Private/Language/locallang.xlf:flux.backendLayout.columnsInParent',
7✔
42
                '--div--'
7✔
43
            );
7✔
44
            $parameters['items'][] = $dividerItem->toArray();
7✔
45
            foreach ($grid->getRows() as $row) {
7✔
46
                foreach ($row->getColumns() as $column) {
7✔
47
                    /** @var SelectOption $item */
48
                    $item = GeneralUtility::makeInstance(
7✔
49
                        SelectOption::class,
7✔
50
                        $column->getLabel(),
7✔
51
                        ColumnNumberUtility::calculateColumnNumberForParentAndColumn(
7✔
52
                            $parentRecordUid,
7✔
53
                            $column->getColumnPosition()
7✔
54
                        )
7✔
55
                    );
7✔
56
                    $parameters['items'][] = $item->toArray();
7✔
57
                }
58
            }
59
        }
60
    }
61
}
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