Index: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (Revision 9177) +++ t3lib/class.t3lib_befunc.php (Arbeitskopie) @@ -2509,7 +2509,44 @@ } } + /** + * 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 'description' (raw, as available in locallang), 'title' (optional), 'moreInfo' + */ + public static function helpTextArray($table, $field) { + if (!isset($GLOBALS['TCA_DESCR'][$table]['columns'])) { + $GLOBALS['LANG']->loadSingleTableDescription($table); + } + $output = array( + 'description' => NULL, + 'title' => NULL, + 'moreInfo' => FALSE, + ); + if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'][$field])) { + $data = $GLOBALS['TCA_DESCR'][$table]['columns'][$field]; + // add alternative title, if defined + if ($data['alttitle']) { + $output['title'] = $data['alttitle']; + } + + // if we have more information to show + if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) { + $output['moreInfo'] = TRUE; + } + + // add description + if ($data['description']) { + $output['description'] = $data['description']; + } + } + 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 +2561,27 @@ * @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'] . '

'; + } + // add the content + if ($helpTextArray['description'] !== NULL) { + $output .= $helpTextArray['description']; + } + // add see also arrow if we have more info + if ($data['moreInfo']) { + $arrow = t3lib_iconWorks::getSpriteIcon('actions-view-go-forward'); + } + // add description text + if ($data['description'] || $arrow) { + $output['description'] = '

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

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

' . $data['alttitle'] . '

' . $output; - } - } return $output; } @@ -2567,10 +2606,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 9177) +++ 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' => '

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

', 'id' => $table . '.' . $field, ); }