39 if (!isset($result[
'processedTca'][
'ctrl'][
'label'])) {
40 throw new \UnexpectedValueException(
41 'TCA of table ' . $result[
'tableName'] .
' misses required [\'ctrl\'][\'label\'] definition.',
46 if ($result[
'isInlineChild'] && isset($result[
'processedTca'][
'ctrl'][
'formattedLabel_userFunc'])) {
49 'table' => $result[
'tableName'],
50 'row' => $result[
'databaseRow'],
52 'isOnSymmetricSide' => $result[
'isOnSymmetricSide'],
53 'options' => $result[
'processedTca'][
'ctrl'][
'formattedLabel_userFunc_options'] ?? [],
55 'uid' => $result[
'databaseRow'][
'uid'],
56 'config' => $result[
'inlineParentConfig']
61 GeneralUtility::callUserFunction($result[
'processedTca'][
'ctrl'][
'formattedLabel_userFunc'], $parameters, $null);
62 $result[
'recordTitle'] = $parameters[
'title'];
63 } elseif ($result[
'isInlineChild'] && (isset($result[
'inlineParentConfig'][
'foreign_label'])
64 || isset($result[
'inlineParentConfig'][
'symmetric_label']))
67 $fieldName = $result[
'isOnSymmetricSide']
68 ? $result[
'inlineParentConfig'][
'symmetric_label']
69 : $result[
'inlineParentConfig'][
'foreign_label'];
71 } elseif (isset($result[
'processedTca'][
'ctrl'][
'label_userFunc'])) {
74 'table' => $result[
'tableName'],
75 'row' => $result[
'databaseRow'],
77 'options' => $result[
'processedTca'][
'ctrl'][
'label_userFunc_options'] ?? [],
80 GeneralUtility::callUserFunction($result[
'processedTca'][
'ctrl'][
'label_userFunc'], $parameters, $null);
81 $result[
'recordTitle'] = $parameters[
'title'];
100 if (!empty($titleByLabel)) {
101 $titles[] = $titleByLabel;
104 $labelAltForce = isset($result[
'processedTca'][
'ctrl'][
'label_alt_force'])
105 ? (bool)$result[
'processedTca'][
'ctrl'][
'label_alt_force']
107 if (!empty($result[
'processedTca'][
'ctrl'][
'label_alt']) && ($labelAltForce || empty($titleByLabel))) {
109 $labelAltFields = GeneralUtility::trimExplode(
',', $result[
'processedTca'][
'ctrl'][
'label_alt'],
true);
110 foreach ($labelAltFields as $fieldName) {
112 if (!empty($titleByLabelAlt)) {
113 $titles[] = $titleByLabelAlt;
115 if (!$labelAltForce && !empty($titleByLabelAlt)) {
123 $result[
'recordTitle'] = implode(
', ', $titles);
136 if ($fieldName ===
'uid') {
138 return $result[
'databaseRow'][
'uid'];
141 if (!isset($result[
'processedTca'][
'columns'][$fieldName][
'config'][
'type'])
142 || !is_string($result[
'processedTca'][
'columns'][$fieldName][
'config'][
'type'])
149 if (array_key_exists($fieldName, $result[
'databaseRow'])) {
150 $rawValue = $result[
'databaseRow'][$fieldName];
152 $fieldConfig = $result[
'processedTca'][
'columns'][$fieldName][
'config'];
153 switch ($fieldConfig[
'type']) {
160 $result[
'processedTca'][
'columns'][$fieldName][
'children']
196 if (!isset($fieldConfig[
'items']) || !is_array($fieldConfig[
'items'])) {
199 foreach ($fieldConfig[
'items'] as $item) {
200 list($itemLabel, $itemValue) = $item;
201 if ((
string)$value === (
string)$itemValue) {
215 foreach ($children as $child) {
216 if ((
int)$value === $child[
'vanillaUid']) {
217 return $child[
'recordTitle'];
233 if (!is_array($value)) {
237 if (!empty($fieldConfig[
'items'])) {
238 $listOfValues = array_column($fieldConfig[
'items'], 1);
239 foreach ($value as $itemValue) {
240 $itemKey = array_search($itemValue, $listOfValues);
241 if ($itemKey !==
false) {
242 $labelParts[] = $fieldConfig[
'items'][$itemKey][0];
246 $title = implode(
', ', $labelParts);
247 if (empty($title) && !empty($value)) {
248 $title = implode(
', ', $value);
262 foreach ($value as $singleValue) {
263 if (isset($singleValue[
'uidOrPath'])) {
264 $labelParts[] = $singleValue[
'uidOrPath'];
265 } elseif (isset($singleValue[
'folder'])) {
266 $labelParts[] = $singleValue[
'folder'];
268 $labelParts[] = $singleValue[
'title'];
271 return implode(
', ', $labelParts);
284 if (empty($fieldConfig[
'items']) || !is_array($fieldConfig[
'items'])) {
285 $title = (bool)$value
286 ? $languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:yes')
287 : $languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:no');
290 foreach ($fieldConfig[
'items'] as $key => $val) {
291 if ($value & pow(2, $key)) {
292 $labelParts[] = $val[0];
295 $title = implode(
', ', $labelParts);
309 if (!isset($value)) {
312 if (!isset($fieldConfig[
'eval'])) {
317 if (GeneralUtility::inList($fieldConfig[
'eval'],
'date')) {
319 if (isset($fieldConfig[
'dbType']) && $fieldConfig[
'dbType'] ===
'date') {
320 $value = $value === $dateTimeFormats[
'date'][
'empty'] ? 0 : (int)strtotime($value);
322 $value = (int)$value;
324 if (!empty($value)) {
327 if (!isset($fieldConfig[
'disableAgeDisplay']) || (bool)$fieldConfig[
'disableAgeDisplay'] ===
false) {
328 $ageDelta =
$GLOBALS[
'EXEC_TIME'] - $value;
331 $this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears')
333 $ageSuffix =
' (' . ($ageDelta > 0 ?
'-' :
'') . $calculatedAge .
')';
337 } elseif (GeneralUtility::inList($fieldConfig[
'eval'],
'time')) {
339 if (isset($fieldConfig[
'dbType']) && $fieldConfig[
'dbType'] ===
'time') {
340 $value = $value === $dateTimeFormats[
'time'][
'empty'] ? 0 : (int)strtotime(
'1970-01-01 ' . $value);
342 $value = (int)$value;
344 if (!empty($value)) {
345 $title = gmdate(
'H:i', (
int)$value);
347 } elseif (GeneralUtility::inList($fieldConfig[
'eval'],
'timesec')) {
349 if (isset($fieldConfig[
'dbType']) && $fieldConfig[
'dbType'] ===
'time') {
350 $value = $value === $dateTimeFormats[
'time'][
'empty'] ? 0 : (int)strtotime(
'1970-01-01 ' . $value);
352 $value = (int)$value;
354 if (!empty($value)) {
355 $title = gmdate(
'H:i:s', (
int)$value);
357 } elseif (GeneralUtility::inList($fieldConfig[
'eval'],
'datetime')) {
359 if (isset($fieldConfig[
'dbType']) && $fieldConfig[
'dbType'] ===
'datetime') {
360 $value = $value === $dateTimeFormats[
'datetime'][
'empty'] ? 0 : (int)strtotime($value);
362 $value = (int)$value;
364 if (!empty($value)) {
379 return trim(strip_tags($value));