Commit a04cfb80 authored by Mathias Brodala's avatar Mathias Brodala Committed by Christian Kuhn
Browse files

[BUGFIX] Let ElementInfo Template take care of proper title crop

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/52692


Reviewed-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: default avatarElmar Hinz <t3elmar@gmail.com>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 7f2c9573
......@@ -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']);
......
<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>
......@@ -129,8 +130,8 @@
<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}
......@@ -157,8 +158,8 @@
<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>
......@@ -182,11 +183,11 @@
<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>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment