Skip to content

Commit e3a98ec

Browse files
committed
Correctly wrap long labels in the tree view (see contao#6954)
1 parent 7cacf24 commit e3a98ec

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

system/modules/core/drivers/DC_Table.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -3580,15 +3580,17 @@ protected function generateTree($table, $id, $arrPrevNext, $blnHasSorting, $intM
35803580
$session[$node][$id] = (is_int($session[$node][$id])) ? $session[$node][$id] : 0;
35813581
$mouseover = ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 5 || $table == $this->strTable) ? ' onmouseover="Theme.hoverDiv(this,1)" onmouseout="Theme.hoverDiv(this,0)" onclick="Theme.toggleSelect(this)"' : '';
35823582

3583-
$return .= "\n " . '<li class="'.((($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 5 && $objRow->type == 'root') || $table != $this->strTable) ? 'tl_folder' : 'tl_file').' click2edit"'.$mouseover.'><div class="tl_left" style="padding-left:'.($intMargin + $intSpacing + (empty($childs) ? 20 : 0)).'px">';
3583+
$return .= "\n " . '<li class="'.((($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 5 && $objRow->type == 'root') || $table != $this->strTable) ? 'tl_folder' : 'tl_file').' click2edit"'.$mouseover.'><div class="tl_left" style="padding-left:'.($intMargin + $intSpacing).'px">';
35843584

35853585
// Calculate label and add a toggle button
35863586
$args = array();
3587+
$folderAttribute = 'style="margin-left:20px"';
35873588
$showFields = $GLOBALS['TL_DCA'][$table]['list']['label']['fields'];
35883589
$level = ($intMargin / $intSpacing + 1);
35893590

35903591
if (!empty($childs))
35913592
{
3593+
$folderAttribute = '';
35923594
$img = ($session[$node][$id] == 1) ? 'folMinus.gif' : 'folPlus.gif';
35933595
$alt = ($session[$node][$id] == 1) ? $GLOBALS['TL_LANG']['MSC']['collapseNode'] : $GLOBALS['TL_LANG']['MSC']['expandNode'];
35943596
$return .= '<a href="'.$this->addToUrl('ptg='.$id).'" title="'.specialchars($alt).'" onclick="Backend.getScrollOffset();return AjaxRequest.toggleStructure(this,\''.$node.'_'.$id.'\','.$level.','.$GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'].')">'.\Image::getHtml($img, '', 'style="margin-right:2px"').'</a>';
@@ -3644,11 +3646,11 @@ protected function generateTree($table, $id, $arrPrevNext, $blnHasSorting, $intM
36443646
$strMethod = $GLOBALS['TL_DCA'][$table]['list']['label']['label_callback'][1];
36453647

36463648
$this->import($strClass);
3647-
$return .= $this->$strClass->$strMethod($objRow->row(), $label, $this, '', false, $blnProtected);
3649+
$return .= $this->$strClass->$strMethod($objRow->row(), $label, $this, $folderAttribute, false, $blnProtected);
36483650
}
36493651
elseif (is_callable($GLOBALS['TL_DCA'][$table]['list']['label']['label_callback']))
36503652
{
3651-
$return .= $GLOBALS['TL_DCA'][$table]['list']['label']['label_callback']($objRow->row(), $label, $this, '', false, $blnProtected);
3653+
$return .= $GLOBALS['TL_DCA'][$table]['list']['label']['label_callback']($objRow->row(), $label, $this, $folderAttribute, false, $blnProtected);
36523654
}
36533655
else
36543656
{
@@ -3719,7 +3721,7 @@ protected function generateTree($table, $id, $arrPrevNext, $blnHasSorting, $intM
37193721

37203722
for ($j=0, $c=count($ids); $j<$c; $j++)
37213723
{
3722-
$return .= $this->generateTree($this->strTable, $ids[$j], array('pp'=>$ids[($j-1)], 'nn'=>$ids[($j+1)]), $blnHasSorting, ($intMargin + $intSpacing), $arrClipboard, false, ($j<(count($ids)-1) || !empty($childs)));
3724+
$return .= $this->generateTree($this->strTable, $ids[$j], array('pp'=>$ids[($j-1)], 'nn'=>$ids[($j+1)]), $blnHasSorting, ($intMargin + $intSpacing + 20), $arrClipboard, false, ($j<(count($ids)-1) || !empty($childs)));
37233725
}
37243726
}
37253727
}

0 commit comments

Comments
 (0)