Bug #70546 ยป patch.diff
typo3/sysext/backend/Classes/Form/Wizard/SuggestWizardDefaultReceiver.php | ||
---|---|---|
*/
|
||
protected function getLabel($row)
|
||
{
|
||
return BackendUtility::getRecordTitle($this->mmForeignTable ? $this->mmForeignTable : $this->table, $row, true);
|
||
return BackendUtility::getRecordTitle($this->mmForeignTable ? $this->mmForeignTable : $this->table, $row, true, true, false);
|
||
}
|
||
/**
|
typo3/sysext/backend/Classes/Utility/BackendUtility.php | ||
---|---|---|
* @param array $row Row from table
|
||
* @param bool $prep If set, result is prepared for output: The output is cropped to a limited length (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '<em>[No title]</em>' is returned (localized). Further, the output is htmlspecialchars()'ed
|
||
* @param bool $forceResult If set, the function always returns an output. If no value is found for the title, '[No title]' is returned (localized).
|
||
* @param bool $addToolTipOnCroppedResult defines if the tooltip from getRecordTitlePrep() should be added or not
|
||
* @return string
|
||
*/
|
||
public static function getRecordTitle($table, $row, $prep = false, $forceResult = true)
|
||
public static function getRecordTitle($table, $row, $prep = false, $forceResult = true, $addToolTipOnCroppedResult = true)
|
||
{
|
||
$cacheIdentifier = $table . '-' . $row['uid'] . '-prep-' . (int)$prep . '-forceResult-' . (int)$forceResult;
|
||
if (isset(self::$recordTitleCache[$cacheIdentifier])) {
|
||
... | ... | |
// If the current result is empty, set it to '[No title]' (localized) and prepare for output if requested
|
||
if ($prep || $forceResult) {
|
||
if ($prep) {
|
||
$recordTitle = self::getRecordTitlePrep($recordTitle);
|
||
$recordTitle = self::getRecordTitlePrep($recordTitle, 0 , $addToolTipOnCroppedResult);
|
||
}
|
||
if (trim($recordTitle) === '') {
|
||
$recordTitle = self::getNoRecordTitle($prep);
|
||
... | ... | |
*
|
||
* @param string $title The title string to be cropped
|
||
* @param int $titleLength Crop title after this length - if not set, BE_USER->uc['titleLen'] is used
|
||
* @param bool $addToolTipOnCroppedResult defines if the tooltip should be added or not - needs to be false for ajax calls like in the suggest wizard
|
||
* @return string The processed title string, wrapped in <span title="...">|</span> if cropped
|
||
*/
|
||
public static function getRecordTitlePrep($title, $titleLength = 0)
|
||
public static function getRecordTitlePrep($title, $titleLength = 0, $addToolTipOnCroppedResult = true)
|
||
{
|
||
// If $titleLength is not a valid positive integer, use BE_USER->uc['titleLen']:
|
||
if (!$titleLength || !MathUtility::canBeInterpretedAsInteger($titleLength) || $titleLength < 0) {
|
||
... | ... | |
$titleOrig = htmlspecialchars($title);
|
||
$title = htmlspecialchars(GeneralUtility::fixed_lgd_cs($title, $titleLength));
|
||
// If title was cropped, offer a tooltip:
|
||
if ($titleOrig != $title) {
|
||
if ($titleOrig != $title && $addToolTipOnCroppedResult) {
|
||
$title = '<span title="' . $titleOrig . '">' . $title . '</span>';
|
||
}
|
||
return $title;
|