2 namespace TYPO3\CMS\Backend\Form\FormDataProvider;
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' => isset($result[
'processedTca'][
'ctrl'][
'formattedLabel_userFunc_options'])
54 ? $result[
'processedTca'][
'ctrl'][
'formattedLabel_userFunc_options']
57 'uid' => $result[
'databaseRow'][
'uid'],
58 'config' => $result[
'inlineParentConfig']
64 $result[
'recordTitle'] = $parameters[
'title'];
65 }
elseif (isset($result[
'processedTca'][
'ctrl'][
'label_userFunc'])) {
68 'table' => $result[
'tableName'],
69 'row' => $result[
'databaseRow'],
71 'options' => isset($result[
'processedTca'][
'ctrl'][
'label_userFunc_options'])
72 ? $result[
'processedTca'][
'ctrl'][
'label_userFunc_options']
77 $result[
'recordTitle'] = $parameters[
'title'];
78 }
elseif ($result[
'isInlineChild'] && isset($result[
'inlineParentConfig'][
'foreign_label'])
79 || $result[
'isInlineChild'] && isset($result[
'inlineParentConfig'][
'symmetric_label'])
82 $fieldName = $result[
'isOnSymmetricSide']
83 ? $result[
'inlineParentConfig'][
'symmetric_label']
84 : $result[
'inlineParentConfig'][
'foreign_label'];
107 if (!empty($titleByLabel)) {
108 $titles[] = $titleByLabel;
111 $labelAltForce = isset($result[
'processedTca'][
'ctrl'][
'label_alt_force'])
112 ? (bool)$result[
'processedTca'][
'ctrl'][
'label_alt_force']
114 if (!empty($result[
'processedTca'][
'ctrl'][
'label_alt']) && ($labelAltForce || empty($titleByLabel))) {
117 foreach ($labelAltFields as $fieldName) {
119 if (!empty($titleByLabelAlt)) {
120 $titles[] = $titleByLabelAlt;
122 if (!$labelAltForce && !empty($titleByLabelAlt)) {
130 $result[
'recordTitle'] = implode(
', ', $titles);
143 if ($fieldName ===
'uid') {
145 return $result[
'databaseRow'][
'uid'];
148 if (!isset($result[
'processedTca'][
'columns'][$fieldName][
'config'][
'type'])
149 || !is_string($result[
'processedTca'][
'columns'][$fieldName][
'config'][
'type'])
156 if (array_key_exists($fieldName, $result[
'databaseRow'])) {
157 $rawValue = $result[
'databaseRow'][$fieldName];
159 $fieldConfig = $result[
'processedTca'][
'columns'][$fieldName][
'config'];
160 switch ($fieldConfig[
'type']) {
198 if (!isset($fieldConfig[
'items']) || !is_array($fieldConfig[
'items'])) {
201 foreach ($fieldConfig[
'items'] as $item) {
202 list($itemLabel, $itemValue) = $item;
203 if ((
string)$value === (
string)$itemValue) {
219 if (!is_array($value)) {
223 foreach ($value as $itemValue) {
224 $itemKey = array_search($itemValue, array_column($fieldConfig[
'items'], 1));
225 if ($itemKey !==
false) {
226 $labelParts[] = $fieldConfig[
'items'][$itemKey][0];
229 $title = implode(
', ', $labelParts);
230 if (empty($title) && !empty($value)) {
231 $title = implode(
', ', $value);
245 if ($fieldConfig[
'internal_type'] !==
'db') {
248 $labelParts = array_map(
249 function ($rawLabelItem) {
254 if (!empty($labelParts)) {
256 return implode(
', ', $labelParts);
271 if (empty($fieldConfig[
'items']) || !is_array($fieldConfig[
'items'])) {
272 $title = (bool)$value
273 ? $languageService->sL(
'LLL:EXT:lang/locallang_common.xlf:yes')
274 : $languageService->sL(
'LLL:EXT:lang/locallang_common.xlf:no');
277 foreach ($fieldConfig[
'items'] as $key => $val) {
278 if ($value & pow(2, $key)) {
279 $labelParts[] = $val[0];
282 $title = implode(
', ', $labelParts);
296 if (!isset($value)) {
301 if (isset($fieldConfig[
'dbType']) && $fieldConfig[
'dbType'] ===
'date') {
302 $value = $value ===
'0000-00-00' ? 0 : (int)strtotime($value);
304 $value = (int)$value;
306 if (!empty($value)) {
309 if (!isset($fieldConfig[
'disableAgeDisplay']) || (bool)$fieldConfig[
'disableAgeDisplay'] ===
false) {
310 $ageDelta =
$GLOBALS[
'EXEC_TIME'] - $value;
313 $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')
315 $ageSuffix =
' (' . ($ageDelta > 0 ?
'-' :
'') . $calculatedAge .
')';
320 if (!empty($value)) {
324 if (!empty($value)) {
329 if (isset($fieldConfig[
'dbType']) && $fieldConfig[
'dbType'] ===
'datetime') {
330 $value = $value ===
'0000-00-00 00:00:00' ? 0 : (int)strtotime($value);
332 $value = (int)$value;
334 if (!empty($value)) {
349 return trim(strip_tags($value));