[BUGFIX] FAL: Invalid title and broken layout 59/27259/3
authorMarcel Wieser <typo3@marcel-wieser.de>
Sun, 2 Feb 2014 11:04:45 +0000 (12:04 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 15 Mar 2014 21:14:04 +0000 (22:14 +0100)
This fix resolves the issue of the wrong title for FAL irre relations.
Now the title of the sys_file metadata will be displayed,
if there's no title for the sys_file_reference.
Additionally the title, labels and placeholder
will be cropped if necessary.

Resolves: #55485
Releases: 6.2
Change-Id: I22b41931e10c565d83edb53ab9689311d13e811a
Reviewed-on: https://review.typo3.org/27259
Reviewed-by: Steffen Ritter
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/core/Classes/Resource/Service/UserFileInlineLabelService.php

index 6641b4f..96ec9ab 100644 (file)
@@ -1167,9 +1167,13 @@ class FormEngine {
                                                . '<span class="t3-tceforms-placeholder-override-checkbox">' .
                                                        '<input type="hidden" name="' . htmlspecialchars($PA['itemFormElNameActive']) . '" value="0" />' .
                                                        '<input type="checkbox" name="' . htmlspecialchars($PA['itemFormElNameActive']) . '" value="1" id="tce-forms-textfield-use-override-' . $field . '-' . $row['uid'] . '" onchange="' . htmlspecialchars($onChange) . '"' . $checked . ' />' .
-                                                       '<label for="tce-forms-textfield-use-override-' . $field . '-' . $row['uid'] . '">' . htmlspecialchars(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.placeholder.override'), $placeholder)) . '</label>' .
+                                                       '<label for="tce-forms-textfield-use-override-' . $field . '-' . $row['uid'] . '">' .
+                                                       sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.placeholder.override'),
+                                                       BackendUtility::getRecordTitlePrep($placeholder, 20)) . '</label>' .
                                                '</span>'
-                                               . '<div class="t3-form-placeholder-placeholder">' . $this->getSingleField_typeNone_render($PA['fieldConf']['config'], $placeholder) . '</div>'
+                                               . '<div class="t3-form-placeholder-placeholder">' . $this->getSingleField_typeNone_render(
+                                                       $PA['fieldConf']['config'], GeneralUtility::fixed_lgd_cs($placeholder, 30)
+                                               ) . '</div>'
                                                . '<div class="t3-form-placeholder-formfield">' . $item . '</div>'
                                                . '</div>';
                                        }
index bb55922..f188788 100644 (file)
@@ -28,6 +28,7 @@ namespace TYPO3\CMS\Core\Resource\Service;
  ***************************************************************/
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 
 /**
@@ -60,9 +61,15 @@ class UserFileInlineLabelService {
                foreach ($sysFileFields as $field) {
                        $value = '';
                        if ($field === 'title') {
-                               $value = isset($params['row']['title'])
-                                       ? htmlspecialchars($params['row']['title'])
-                                       : BackendUtility::getRecordTitle('sys_file', $fileRecord, TRUE);
+                               if (isset($params['row']['title'])) {
+                                       $fullTitle = $params['row']['title'];
+                               } else {
+                                       $metaDataRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository');
+                                       $metaData = $metaDataRepository->findByFileUid($fileRecord['uid']);
+                                       $fullTitle = $metaData['title'];
+                               }
+
+                               $value = BackendUtility::getRecordTitlePrep(htmlspecialchars($fullTitle));
                        } else {
                                if (isset($params['row'][$field])) {
                                        $value = htmlspecialchars($params['row'][$field]);