Index: t3lib/class.t3lib_tceforms.php =================================================================== --- t3lib/class.t3lib_tceforms.php (revision 10170) +++ t3lib/class.t3lib_tceforms.php (working copy) @@ -1829,18 +1829,27 @@ '$(\'' . $rowId . '\').removeClassName(\'c-selectedItem\');$(\'' . $rowId . '\').removeClassName(\'c-unselectedItem\');' . '$(\'' . $rowId . '\').addClassName(\'c-' . ($sM ? '' : 'un') . 'selectedItem\');'; - $hasHelp = ($p[3] != ''); + // Check if some help text is available + // Since TYPO3 4.5 help text is expected to be an associative array + // with two key, "title" and "description" + // For the sake of backwards compatibility, we test if the help text + // is a string and use it as a description (this could happen if items + // are modified with an itemProcFunc) + $hasHelp = FALSE; + $help = ''; + $helpArray = array(); + if ((is_array($p[3]) && count($p[3]) > 0) || !empty($p[3])) { + $hasHelp = TRUE; + if (is_array($p[3])) { + $helpArray = $p[3]; + } else { + $helpArray['description'] = $p[3]; + } + } $label = t3lib_div::deHSCentities(htmlspecialchars($p[0])); - $help = $hasHelp ? '' . $label . '' . - '' . $GLOBALS['LANG']->hscAndCharConv(nl2br(trim(htmlspecialchars($p[3]))), false) . '' : ''; - - if ($hasHelp && $this->edit_showFieldHelp == 'icon') { - $helpIcon = ''; - $helpIcon .= t3lib_iconWorks::getSpriteIcon('actions-system-help-open'); - $helpIcon .= $help; - $helpIcon .= ''; - $help = $helpIcon; + if ($hasHelp) { + $help = t3lib_BEfunc::wrapInHelp('', '', '', $helpArray); } $tRows[] = ' @@ -1850,7 +1859,7 @@ $this->getIconHtml($selIcon) . $label . ' - ' . (strcmp($p[3], '') ? $help : '') . ' + ' . ((empty($help)) ? '' : $help) . ' '; $c++; } @@ -4644,11 +4653,12 @@ // Icon: $icon = t3lib_iconWorks::mapRecordTypeToSpriteIconName($theTableNames, array()); - // Add description texts: - if ($this->edit_showFieldHelp) { - $GLOBALS['LANG']->loadSingleTableDescription($theTableNames); - $fDat = $GLOBALS['TCA_DESCR'][$theTableNames]['columns']['']; - $descr = $fDat['description']; + // Add help text + $helpText = array(); + $GLOBALS['LANG']->loadSingleTableDescription($theTableNames); + $helpTextArray = $GLOBALS['TCA_DESCR'][$theTableNames]['columns']['']; + if (isset($helpTextArray['description'])) { + $helpText['description'] = $helpTextArray['description']; } // Item configuration: @@ -4656,7 +4666,7 @@ $this->sL($TCA[$theTableNames]['ctrl']['title']), $theTableNames, $icon, - $descr + $helpText ); } } @@ -4683,11 +4693,12 @@ foreach ($theTypes as $theTypeArrays) { list($theTable, $theField) = explode(':', $theTypeArrays[1]); - // Add description texts: - if ($this->edit_showFieldHelp) { - $GLOBALS['LANG']->loadSingleTableDescription($theTable); - $fDat = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theField]; - $descr = $fDat['description']; + // Add help text + $helpText = array(); + $GLOBALS['LANG']->loadSingleTableDescription($theTable); + $helpTextArray = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theField]; + if (isset($helpTextArray['description'])) { + $helpText['description'] = $helpTextArray['description']; } // Item configuration: @@ -4695,7 +4706,7 @@ rtrim($theTypeArrays[0], ':'), $theTypeArrays[1], 'empty-empty', - $descr + $helpText ); } break; @@ -4754,12 +4765,18 @@ $icon = 'empty-empty'; } + // Add help text + $helpText = array(); + if (isset($itemCfg[2])) { + $helpText['description'] = $GLOBALS['LANG']->sl($itemCfg[2]); + } + // Add item to be selected: $items[] = array( $GLOBALS['LANG']->sl($itemCfg[0]), $coKey . ':' . preg_replace('/[:|,]/', '', $itemKey), $icon, - $GLOBALS['LANG']->sl($itemCfg[2]), + $helpText, ); } } @@ -4783,19 +4800,18 @@ $icon = '../' . substr($icon, strlen(PATH_site)); } - // Description texts: - if ($this->edit_showFieldHelp) { - $descr = $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tablabel'] . - LF . - $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tabdescr']; - } + // Add help text + $helpText = array( + 'title' => $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tablabel'], + 'description' => $GLOBALS['LANG']->moduleLabels['labels'][$theMod . '_tabdescr'] + ); // Item configuration: $items[] = array( $this->addSelectOptionsToItemArray_makeModuleData($theMod), $theMod, $icon, - $descr + $helpText ); } } Index: t3lib/js/extjs/contexthelp.js =================================================================== --- t3lib/js/extjs/contexthelp.js (revision 10170) +++ t3lib/js/extjs/contexthelp.js (working copy) @@ -55,20 +55,32 @@ if (response) { updateTip(response); } else { - // clear old tooltip contents - updateTip({ - description: top.TYPO3.LLL.core.csh_tooltip_loading, - cshLink: '', - moreInfo: '', - title: '' - }); - // load content - TYPO3.CSH.ExtDirect.getContextHelp(table, field, function(response, options) { - cshHelp.add(response); - updateTip(response); - // Need to re-position because the height may have increased - tip.show(); - }, this); + // If a table is defined, use ExtDirect call to get the tooltip's content + if (table) { + // Clear old tooltip contents + updateTip({ + description: top.TYPO3.LLL.core.csh_tooltip_loading, + cshLink: '', + moreInfo: '', + title: '' + }); + // Load content + TYPO3.CSH.ExtDirect.getContextHelp(table, field, function(response, options) { + cshHelp.add(response); + updateTip(response); + // Need to re-position because the height may have increased + tip.show(); + }, this); + + // No table was given, use directly title and description + } else { + updateTip({ + description: link.getAttribute('data-description'), + cshLink: '', + moreInfo: '', + title: link.getAttribute('data-title') + }); + } } } Index: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (revision 10170) +++ t3lib/class.t3lib_befunc.php (working copy) @@ -2714,21 +2714,40 @@ * @return string the HTML code ready to render * @api public */ - public static function wrapInHelp($table, $field, $text = '') { - // get the help text that should be shown on hover - $GLOBALS['LANG']->loadSingleTableDescription($table); - $helpText = self::helpText($table, $field); + public static function wrapInHelp($table, $field, $text = '', array $overloadHelpText = array()) { + // Initialize some avriables + $helpText = ''; $abbrClassAdd = ''; - if ($helpText) { - // if no text was given, just use the regular help icon + $wrappedText = ''; + $hasHelpTextOverload = count($overloadHelpText) > 0; + + // Get the help text that should be shown on hover + if (!$hasHelpTextOverload) { + $helpText = self::helpText($table, $field); + } + + // If there's a help text or some overload information, proceed with preparing an output + if (!empty($helpText) || $hasHelpTextOverload) { + // If no text was given, just use the regular help icon if ($text == '') { $text = t3lib_iconWorks::getSpriteIcon('actions-system-help-open'); $abbrClassAdd = '-icon'; } $text = '' . $text . ''; - $text = '' . $text . ''; + $wrappedText = ''; } - return $text; + return $wrappedText; }