[BUGFIX] Let ElementInfo Template take care of proper title crop 94/52794/2
authorMathias Brodala <mbrodala@pagemachine.de>
Wed, 3 May 2017 07:27:21 +0000 (09:27 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 12 May 2017 14:16:02 +0000 (16:16 +0200)
If the title is too long, it gets cropped. Then, the link title must
contain the whole string in order to provide a proper tooltip.

Resolves: #81124
Releases: master, 8.7
Change-Id: I55b4784c431b4a495dc4089ab954eb3c7e1ca435
Reviewed-on: https://review.typo3.org/52794
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php
typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html

index 038a8d7..2468088 100644 (file)
@@ -237,6 +237,7 @@ class ElementInformationController
             $view->assignMultiple($this->getPropertiesForTable());
             $view->assignMultiple($this->getReferences());
             $view->assignMultiple($this->getBackButton());
+            $view->assign('maxTitleLength', $this->getBackendUser()->uc['titleLen'] ?? 20);
             $content .=  $view->render();
         }
         $this->moduleTemplate->setContent($content);
@@ -250,7 +251,7 @@ class ElementInformationController
     protected function getPageTitle() : array
     {
         $pageTitle = [
-            'title' => strip_tags(BackendUtility::getRecordTitle($this->table, $this->row))
+            'title' => BackendUtility::getRecordTitle($this->table, $this->row, false)
         ];
         if ($this->type === 'folder') {
             $pageTitle['table'] = $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:folder');
@@ -585,7 +586,7 @@ class ElementInformationController
                 $line['icon'] = $this->iconFactory->getIconForRecord($row['tablename'], $record, Icon::SIZE_SMALL)->render();
                 $line['row'] = $row;
                 $line['record'] = $record;
-                $line['recordTitle'] = BackendUtility::getRecordTitle($row['tablename'], $record, true);
+                $line['recordTitle'] = BackendUtility::getRecordTitle($row['tablename'], $record, false, true);
                 $line['parentRecordTitle'] = $parentRecordTitle;
                 $line['title'] = $lang->sL($GLOBALS['TCA'][$row['tablename']]['ctrl']['title']);
                 $line['labelForTableColumn'] = $this->getLabelForTableColumn($row['tablename'], $row['field']);
@@ -649,7 +650,7 @@ class ElementInformationController
                 $line['icon'] = $this->iconFactory->getIconForRecord($row['tablename'], $record, Icon::SIZE_SMALL)->render();
                 $line['row'] = $row;
                 $line['record'] = $record;
-                $line['recordTitle'] = BackendUtility::getRecordTitle($row['ref_table'], $record, true);
+                $line['recordTitle'] = BackendUtility::getRecordTitle($row['ref_table'], $record, false, true);
                 $line['title'] = $lang->sL($GLOBALS['TCA'][$row['ref_table']]['ctrl']['title']);
                 $line['labelForTableColumn'] = $this->getLabelForTableColumn($table, $row['field']);
                 $line['actions'] = $this->getRecordActions($row['ref_table'], $row['ref_uid']);
index 7191778..ed1f240 100644 (file)
@@ -1,6 +1,7 @@
 <h1>
     <f:if condition="{table}">
-        <small>{table}</small><br />{icon -> f:format.raw()}{title}
+      <small>{table}</small><br />{icon -> f:format.raw()}
+      <span title="{title}">{title -> f:format.crop(maxCharacters: maxTitleLength)}</span>
     </f:if>
 </h1>
 <f:if condition="{missingFile}">
@@ -62,7 +63,7 @@
             </thead>
             <tbody>
                 <f:for each="{refLines}" as="refLine">
-                    <f:render section="refLineRow" arguments="{line: refLine}" />
+                    <f:render section="refLineRow" arguments="{line: refLine, maxTitleLength: maxTitleLength}" />
                 </f:for>
             </tbody>
         </table>
@@ -88,7 +89,7 @@
             </thead>
             <tbody>
                 <f:for each="{refFromLines}" as="refFromLine">
-                    <f:render section="refFromLineRow" arguments="{line: refFromLine}" />
+                    <f:render section="refFromLineRow" arguments="{line: refFromLine, maxTitleLength: maxTitleLength}" />
                 </f:for>
             </tbody>
         </table>
     <tr>
         <f:if condition="{line.record}">
             <f:then>
-                <td class="col-icon"><a href="{line.url}" title="id={line.record.uid}">{line.icon -> f:format.raw()}</a></td>
-                <td class="col-title"><a href="{line.url}" title="id={line.record.uid}" >{line.recordTitle}</a></td>
+                <td class="col-icon"><f:link.page pageUid="{line.url}" title="id={line.record.uid}">{line.icon -> f:format.raw()}</f:link.page></td>
+                <td class="col-title"><f:link.page pageUid="{line.url}" title="[id={line.record.uid}] {line.recordTitle}">{line.recordTitle -> f:format.crop(maxCharacters: maxTitleLength)}</f:link.page></td>
                 <td>{line.title}</td>
                 <td><span title="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:page')}: {line.parentRecordTitle} (uid={line.record.pid})">
                         {line.record.uid}
     <tr>
         <f:if condition="{line.record}">
             <f:then>
-                <td class="col-icon"><a href="{line.url}" title="id={line.record.uid}">{line.icon -> f:format.raw()}</a></td>
-                <td class="col-title"><a href="{line.url}" title="id={line.record.uid}" >{line.recordTitle}</a></td>
+                <td class="col-icon"><f:link.page pageUid="{line.url}" title="id={line.record.uid}">{line.icon -> f:format.raw()}</f:link.page></td>
+                <td class="col-title"><f:link.page pageUid="{line.url}" title="[id={line.record.uid}] {line.recordTitle}">{line.recordTitle -> f:format.crop(maxCharacters: maxTitleLength)}</f:link.page></td>
                 <td>{line.title}</td>
                 <td>{line.row.ref_uid}</td>
             </f:then>
 
 <f:section name="action">
     <div class="btn-group" role="group">
-       <f:if condition="{line.webListUrl}">
+        <f:if condition="{line.webListUrl}">
             <a class="btn btn-default btn-sm" href="#" onclick="{line.viewOnClick}" title="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:labels.showPage')}">
                 <core:icon identifier="actions-document-view" size="small" />
             </a>
-       </f:if>
+        </f:if>
         <a class="btn btn-default btn-sm" href="{line.recordEditUrl}">
             <core:icon identifier="actions-open" size="small" />
         </a>