initializeResultArray(); $fieldName = $this->data['fieldName']; $fieldConfig = $this->data['processedTca']['columns'][$fieldName]; $fieldType = $fieldConfig['config']['type']; $l10nDisplay = $this->data['parameterArray']['fieldConf']['l10n_display'] ?? ''; $defaultLanguageRow = $this->data['defaultLanguageRow'] ?? null; if (!is_array($defaultLanguageRow) || GeneralUtility::inList($l10nDisplay, 'hideDiff') || GeneralUtility::inList($l10nDisplay, 'defaultAsReadonly') || $fieldType === 'inline' || $fieldType === 'file' || $fieldType === 'flex' || (in_array($fieldType, ['select', 'category', 'group'], true) && isset($fieldConfig['config']['MM'])) ) { // Early return if there is no default language row or the display is disabled return $result; } $table = $this->data['tableName']; $html = []; $defaultLanguageValue = BackendUtility::getProcessedValue( $table, $fieldName, $defaultLanguageRow[$fieldName], 0, true, false, $defaultLanguageRow['uid'], true, $defaultLanguageRow['pid'], $defaultLanguageRow ) ?? ''; if ($defaultLanguageValue !== '') { $iconIdentifier = ($this->data['systemLanguageRows'][0]['flagIconIdentifier'] ?? false) ?: 'flags-multiple'; $html[] = '
'; $html[] = $this->iconFactory->getIcon($iconIdentifier, IconSize::SMALL)->render(); $html[] = $this->previewFieldValue($defaultLanguageValue); $html[] = '
'; } $additionalPreviewLanguages = $this->data['additionalLanguageRows']; foreach ($additionalPreviewLanguages as $previewLanguage) { $defaultLanguageValue = BackendUtility::getProcessedValue( $table, $fieldName, $previewLanguage[$fieldName], 0, true, false, 0, true, 0, $previewLanguage ) ?? ''; if ($defaultLanguageValue !== '') { $html[] = '
'; $html[] = $this->iconFactory->getIcon($this->data['systemLanguageRows'][$previewLanguage['language_tag']]['flagIconIdentifier'], IconSize::SMALL)->render(); $html[] = $this->previewFieldValue($defaultLanguageValue); $html[] = '
'; } } $result['html'] = implode(LF, $html); return $result; } /** * Rendering preview output of a field value which is not shown as a form field but just outputted. * * @param string $value The value to output * @return string HTML formatted output */ protected function previewFieldValue($value) { return nl2br(htmlspecialchars((string)$value)); } }