ew_base/Classes/Form/FormDataProvider/UsercentricsTcaInline.php
Sebastian Fischer 5319bd35a5 First commit
2024-02-09 17:13:28 +01:00

56 lines
1.7 KiB
PHP
Executable File

<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace Evoweb\EwBase\Form\FormDataProvider;
use TYPO3\CMS\Backend\Form\FormDataProvider\SiteTcaInline;
/**
* Special data provider for the sites configuration module.
*
* Handle inline children of 'site'
*/
class UsercentricsTcaInline extends SiteTcaInline
{
/**
* Resolve inline fields
*
* @param array $result
* @return array
*/
public function addData(array $result): array
{
$result = $this->addInlineFirstPid($result);
foreach ($result['processedTca']['columns'] as $fieldName => $fieldConfig) {
if (!$this->isInlineField($fieldConfig)) {
continue;
}
$childTableName = $fieldConfig['config']['foreign_table'] ?? '';
if (!in_array($childTableName, ['site_usercentrics'], true)) {
continue;
}
$result['processedTca']['columns'][$fieldName]['children'] = [];
$result = $this->resolveSiteRelatedChildren($result, $fieldName);
if (!empty($result['processedTca']['columns'][$fieldName]['config']['selectorOrUniqueConfiguration'])) {
throw new \RuntimeException('selectorOrUniqueConfiguration not implemented in sites module', 1624313533);
}
}
return $result;
}
}