17 use Doctrine\DBAL\Connection;
42 foreach ($result[
'processedTca'][
'columns'] as $fieldName => $fieldConfig) {
45 ($fieldConfig[
'config'][
'type'] !==
'input' && $fieldConfig[
'config'][
'type'] !==
'text')
46 || !isset($fieldConfig[
'config'][
'placeholder'])
52 if (strpos($fieldConfig[
'config'][
'placeholder'],
'__row|') === 0) {
54 $fieldNameArray = array_slice(
55 GeneralUtility::trimExplode(
'|', $fieldConfig[
'config'][
'placeholder'],
true),
58 $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'placeholder'] = $this->
getPlaceholderValue($fieldNameArray, $result);
62 if (strpos($fieldConfig[
'config'][
'placeholder'],
'LLL:') === 0) {
63 $result[
'processedTca'][
'columns'][$fieldName][
'config'][
'placeholder'] = $this->
getLanguageService()->
sL($fieldConfig[
'config'][
'placeholder']);
67 if (empty($result[
'processedTca'][
'columns'][$fieldName][
'config'][
'placeholder'])) {
68 unset($result[
'processedTca'][
'columns'][$fieldName][
'config'][
'placeholder']);
87 if ($recursionLevel > 99) {
92 $fieldName = array_shift($fieldNameArray);
96 if (!array_key_exists($fieldName, $result[
'databaseRow'])) {
100 $value = $result[
'databaseRow'][$fieldName];
102 if (!isset($result[
'processedTca'][
'columns'][$fieldName][
'config'])
103 || !is_array($result[
'processedTca'][
'columns'][$fieldName][
'config'])
105 return (
string)$value;
108 $fieldConfig = $result[
'processedTca'][
'columns'][$fieldName][
'config'];
110 switch ($fieldConfig[
'type']) {
114 $possibleUids = array_filter($value);
115 $foreignTableName = $fieldConfig[
'foreign_table'];
122 $possibleUids = array_filter(GeneralUtility::trimExplode(
',', $value,
true));
123 $foreignTableName = $fieldConfig[
'foreign_table'];
127 $foreignTableName =
'';
130 if (!empty($possibleUids) && !empty($fieldNameArray)) {
131 if (count($possibleUids) > 1
132 && !empty(
$GLOBALS[
'TCA'][$foreignTableName][
'ctrl'][
'languageField'])
133 && isset($result[
'currentSysLanguage'])
137 $relatedFormData = $this->
getRelatedFormData($foreignTableName, $possibleUids[0], $fieldNameArray[0]);
138 if (!empty(
$GLOBALS[
'TCA'][$result[
'tableName']][
'ctrl'][
'languageField'])
139 && isset($result[
'databaseRow'][
$GLOBALS[
'TCA'][$result[
'tableName']][
'ctrl'][
'languageField']])
141 $relatedFormData[
'currentSysLanguage'] = $result[
'databaseRow'][
$GLOBALS[
'TCA'][$result[
'tableName']][
'ctrl'][
'languageField']][0];
146 if ($recursionLevel === 0 && is_array($value)) {
147 $value = implode(
', ', $value);
149 return (
string)$value;
164 'vanillaUid' => (int)$uid,
165 'tableName' => $tableName,
166 'inlineCompileExistingChildren' =>
false,
167 'columnsToProcess' => [$columnToProcess],
170 $formDataGroup = GeneralUtility::makeInstance(TcaInputPlaceholderRecord::class);
172 $formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup);
173 $compilerResult = $formDataCompiler->compile($fakeDataInput);
174 return $compilerResult;
193 if (($fieldConfig[
'internal_type'] !==
'db') || ($allowedTable ===
false)) {
198 foreach ($value as $singleValue) {
199 $relatedUids[] = $singleValue[
'uid'];
215 $allowedTable =
false;
217 $allowedTables = GeneralUtility::trimExplode(
',', $fieldConfig[
'allowed'],
true);
218 if (count($allowedTables) === 1) {
219 $allowedTable = $allowedTables[0];
222 return $allowedTable;
239 $languageField =
$GLOBALS[
'TCA'][$foreignTableName][
'ctrl'][
'languageField'];
240 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($foreignTableName);
241 $possibleRecords = $queryBuilder->select(
'uid', $languageField)
242 ->from($foreignTableName)
244 $queryBuilder->expr()->in(
246 $queryBuilder->createNamedParameter($possibleUids, Connection::PARAM_INT_ARRAY)
248 $queryBuilder->expr()->in(
250 $queryBuilder->createNamedParameter([$currentLanguage, 0], Connection::PARAM_INT_ARRAY)
253 ->groupBy($languageField,
'uid')
257 if (!empty($possibleRecords)) {
259 if (count($possibleRecords) === 1
260 || (
int)$possibleRecords[0][$languageField] === (
int)$currentLanguage
262 return [$possibleRecords[0][
'uid']];
266 return [$possibleRecords[1][
'uid']];
269 return $possibleUids;