Index: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (Revision 9175) +++ t3lib/class.t3lib_befunc.php (Arbeitskopie) @@ -2509,7 +2509,41 @@ } } + /** + * Returns CSH help text (description), if configured for, as an array (title, description) + * Will automatically call t3lib_BEfunc::helpTextIcon() to get the icon for the text. + * + * @param string Table name + * @param string Field name + * @return array With keys 'content' (html content) and (optional) 'title' + */ + public static function helpTextArray($table, $field) { + if (!isset($GLOBALS['TCA_DESCR'][$table]['columns'])) { + $GLOBALS['LANG']->loadSingleTableDescription($table); + } + $output = array( + 'content' => NULL, + 'title' => NULL, + ); + if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'][$field])) { + $data = $GLOBALS['TCA_DESCR'][$table]['columns'][$field]; + // add see also arrow + if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) { + $arrow = t3lib_iconWorks::getSpriteIcon('actions-view-go-forward'); + } + // add description text + if ($data['description'] || $arrow) { + $output['content'] = '

' . nl2br(htmlspecialchars($data['description'])) . $arrow . '

'; + } + // add alternative title, if defined + if ($data['alttitle']) { + $output['title'] = $data['alttitle']; + } + } + return $output; + } + /** * Returns CSH help text (description), if configured for. * TCA_DESCR must be loaded prior to this function and $BE_USER must have "edit_showFieldHelp" set to "text", @@ -2524,25 +2558,18 @@ * @return string HTML content for help text */ public static function helpText($table, $field, $BACK_PATH = '', $styleAttrib = '') { - global $TCA_DESCR, $BE_USER; + $helpTextArray = self::helpTextArray($table, $field); + $output = ''; - if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field])) { - $data = $TCA_DESCR[$table]['columns'][$field]; - // add see also arrow - if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) { - $arrow = t3lib_iconWorks::getSpriteIcon('actions-view-go-forward'); - } - // add description text - if ($data['description'] || $arrow) { - $output = '

' . nl2br(htmlspecialchars($data['description'])) . $arrow . '

'; - } + // put header before the rest of the text + if ($helpTextArray['title'] !== NULL) { + $output .= '

' . $helpTextArray['title'] . '

'; + } + if ($helpTextArray['content'] !== NULL) { + $output .= $helpTextArray['content']; + } - // put header before the rest of the text - if ($data['alttitle']) { - $output = '

' . $data['alttitle'] . '

' . $output; - } - } return $output; } @@ -2567,10 +2594,7 @@ if ($text == '') { $text = t3lib_iconWorks::getSpriteIcon('actions-system-help-open'); } - - $helpText = '
' . $helpText . '
'; $text = '' . $text . ''; - $text = '' . $text . ''; } return $text; Index: t3lib/extjs/dataprovider/class.extdirect_dataprovider_contexthelp.php =================================================================== --- t3lib/extjs/dataprovider/class.extdirect_dataprovider_contexthelp.php (Revision 9176) +++ t3lib/extjs/dataprovider/class.extdirect_dataprovider_contexthelp.php (Arbeitskopie) @@ -38,23 +38,10 @@ * @return array complete help information */ public function getContextHelp($table, $field) { - - if (!isset($GLOBALS['TCA_DESCR'][$table]['columns'])) { - $GLOBALS['LANG']->loadSingleTableDescription($table); - } - $data = $GLOBALS['TCA_DESCR'][$table]['columns'][$field]; - - - // add description text - if ($data['description']) { - $description = '

' . nl2br(strip_tags($data['description'])) . '

'; - } - - $title = $data['alttitle'] ? $data['alttitle'] : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_view_help.xml:title'); - + $helpTextArray = t3lib_befunc::helpTextArray($table, $field); return array( - 'title' => $title, - 'description' => $description, + 'title' => $helpTextArray['title'], + 'description' => $helpTextArray['content'], 'id' => $table . '.' . $field, ); }