getLanguageService(); $pageId = !empty($result['effectivePid']) ? (int)$result['effectivePid'] : (int)$result['databaseRow']['pid']; $backendLayout = $this->backendLayoutView->getBackendLayoutForPage($pageId); $recordType = $result['databaseRow']['CType'][0] ?? ''; $currentColPos = (int)($result['databaseRow']['colPos'][0] ?? 0); foreach ($result['processedTca']['columns']['colPos']['config']['items'] as $key => $item) { $itemColPosValue = (int)($item['value']); $columnConfiguration = $this->backendLayoutView->getColPosConfigurationForPage($backendLayout, $itemColPosValue, $pageId, $result['request']); if (empty($columnConfiguration)) { continue; } if (!empty($columnConfiguration['allowedContentTypes'])) { $allowedContentTypes = GeneralUtility::trimExplode(',', $columnConfiguration['allowedContentTypes'], true); if (!in_array($recordType, $allowedContentTypes, true) && $currentColPos !== $itemColPosValue ) { unset($result['processedTca']['columns']['colPos']['config']['items'][$key]); } if (!in_array($recordType, $allowedContentTypes, true) && $currentColPos === $itemColPosValue ) { $newLabel = sprintf($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'), $currentColPos); $result['processedTca']['columns']['colPos']['config']['items'][$key]['label'] = $newLabel; } } if (!empty($columnConfiguration['disallowedContentTypes'])) { $disallowedContentTypes = GeneralUtility::trimExplode(',', $columnConfiguration['disallowedContentTypes'], true); if (in_array($recordType, $disallowedContentTypes, true) && $currentColPos !== $itemColPosValue ) { unset($result['processedTca']['columns']['colPos']['config']['items'][$key]); } if (in_array($recordType, $disallowedContentTypes, true) && $currentColPos === $itemColPosValue ) { $newLabel = sprintf($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'), $currentColPos); $result['processedTca']['columns']['colPos']['config']['items'][$key]['label'] = $newLabel; } } } return $result; } private function getLanguageService(): LanguageService { return $GLOBALS['LANG']; } }