Added feature #11374: Add Linebreak in Palette of TCEFORMS
authorSteffen Kamper <info@sk-typo3.de>
Mon, 31 Aug 2009 07:38:33 +0000 (07:38 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Mon, 31 Aug 2009 07:38:33 +0000 (07:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5849 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms.php

index ef5ea99..2cf6b6f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-31  Steffen Kamper  <info@sk-typo3.de>
+
+       * Added feature #11374: Add Linebreak in Palette of TCEFORMS
+
 2009-08-30  Oliver Hader  <oliver@typo3.org>
 
        * Added feature #9292: Integrate hook at the end of tslib_cObj::getImgResource
index e36ef6f..4ad0ca3 100644 (file)
@@ -3265,8 +3265,9 @@ class t3lib_TCEforms      {
                                foreach($fields as $info)       {
                                        $fieldParts = t3lib_div::trimExplode(';',$info);
                                        $theField = $fieldParts[0];
-
-                                       if (!in_array($theField,$this->excludeElements) && $TCA[$table]['columns'][$theField])  {
+                                       if ($theField === '--linebreak--') {
+                                               $parts[]['NAME'] = '--linebreak--';
+                                       } elseif (!in_array($theField,$this->excludeElements) && $TCA[$table]['columns'][$theField])    {
                                                $this->palFieldArr[$palette][] = $theField;
                                                $elem = $this->getSingleField($table,$theField,$row,$fieldParts[1],1,'',$fieldParts[2]);
                                                if (is_array($elem))    {
@@ -4906,15 +4907,26 @@ class t3lib_TCEforms    {
                $ccAttr4 = $this->colorScheme[4] ? ' style="color:'.$this->colorScheme[4].'"' : '';
                $ccAttr4.= $this->classScheme[4] ? ' class="'.$this->classScheme[4].'"' : '';
 
+               $row = 0;
+               $hRow = $iRow = array();
+               $lastLineWasLinebreak = FALSE;
+
                        // Traverse palette fields and render them into table rows:
                foreach($palArr as $content)    {
-                       $hRow[]='<td'.$ccAttr2.'>&nbsp;</td>
+                       if ($content['NAME'] === '--linebreak--') {
+                               if (!$lastLineWasLinebreak) {
+                                       $row++;
+                                       $lastLineWasLinebreak = TRUE;
+                               }
+                       } else {
+                               $lastLineWasLinebreak = FALSE;
+                               $hRow[$row][] = '<td' . $ccAttr2 . '>&nbsp;</td>
                                        <td nowrap="nowrap"'.$ccAttr2.'>'.
                                                '<span'.$ccAttr4.'>'.
                                                        $content['NAME'].
                                                '</span>'.
                                        '</td>';
-                       $iRow[]='<td valign="top">'.
+                               $iRow[$row][] = '<td valign="top">' .
                                                '<img name="req_'.$content['TABLE'].'_'.$content['ID'].'_'.$content['FIELD'].'" src="clear.gif" width="10" height="10" vspace="4" alt="" />'.
                                                '<img name="cm_'.$content['TABLE'].'_'.$content['ID'].'_'.$content['FIELD'].'" src="clear.gif" width="7" height="10" vspace="4" alt="" />'.
                                        '</td>
@@ -4923,20 +4935,24 @@ class t3lib_TCEforms    {
                                                $content['HELP_ICON'].
                                        '</td>';
                }
+               }
 
                        // Final wrapping into the table:
-               $out='<table border="0" cellpadding="0" cellspacing="0" class="typo3-TCEforms-palette">
+               $out='<table border="0" cellpadding="0" cellspacing="0" class="typo3-TCEforms-palette">';
+               for ($i=0; $i<=$row; $i++) {
+                       $out .= '
                        <tr>
                                <td><img src="clear.gif" width="'.intval($this->paletteMargin).'" height="1" alt="" /></td>'.
                                        implode('
-                               ',$hRow).'
+                                       ', $hRow[$i]) . '
                        </tr>
                        <tr>
                                <td></td>'.
                                        implode('
-                               ',$iRow).'
-                       </tr>
-               </table>';
+                                       ', $iRow[$i]) . '
+                               </tr>';
+               }
+               $out .= '</table>';
 
                return $out;
        }