Bug #23798 ยป 16074.diff
t3lib/class.t3lib_befunc.php (Arbeitskopie) | ||
---|---|---|
}
|
||
}
|
||
/**
|
||
* 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'] = '<p class="t3-help-short">' . nl2br(htmlspecialchars($data['description'])) . $arrow . '</p>';
|
||
}
|
||
// 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",
|
||
... | ... | |
* @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 = '<p class="t3-help-short">' . nl2br(htmlspecialchars($data['description'])) . $arrow . '</p>';
|
||
}
|
||
// put header before the rest of the text
|
||
if ($helpTextArray['title'] !== NULL) {
|
||
$output .= '<h2 class="t3-row-header">' . $helpTextArray['title'] . '</h2>';
|
||
}
|
||
if ($helpTextArray['content'] !== NULL) {
|
||
$output .= $helpTextArray['content'];
|
||
}
|
||
// put header before the rest of the text
|
||
if ($data['alttitle']) {
|
||
$output = '<h2 class="t3-row-header">' . $data['alttitle'] . '</h2>' . $output;
|
||
}
|
||
}
|
||
return $output;
|
||
}
|
||
... | ... | |
if ($text == '') {
|
||
$text = t3lib_iconWorks::getSpriteIcon('actions-system-help-open');
|
||
}
|
||
$helpText = '<div class="t3-help-inline">' . $helpText . '</div>';
|
||
$text = '<abbr class="t3-help-teaser">' . $text . '</abbr>';
|
||
$text = '<a class="t3-help-link" href="#" data-table="' . $table . '" data-field="' . $field . '">' . $text . '</a>';
|
||
}
|
||
return $text;
|
t3lib/extjs/dataprovider/class.extdirect_dataprovider_contexthelp.php (Arbeitskopie) | ||
---|---|---|
* @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 = '<p class="t3-help-short">' . nl2br(strip_tags($data['description'])) . '</p>';
|
||
}
|
||
$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,
|
||
);
|
||
}
|