function theme_requirement_help in Hosting 5
Theme function for displaying contextual help.
Can control individual components of the help, for display in various places.
1 theme call to theme_requirement_help()
- _hosting_requirements in ./
hosting_help.inc - Helper function for displaying contextual help when not used in a form.
File
- ./
hosting_help.inc, line 485 - Hosting help subsystem
Code
function theme_requirement_help(&$element) {
drupal_add_js(drupal_get_path('module', 'hosting') . '/hosting_help.js');
drupal_add_css(drupal_get_path('module', 'hosting') . '/hosting_help.css');
$req = $element['#requirement'];
$help = $element['#help'];
// this is just to make it easier to work with.
//place anchor so user can be directed to right page.
$output .= "<a name='hosting-help-{$req}'></a>";
$output .= '<div class="hosting-' . form_clean_id($element["#type"]) . ' ' . _hosting_status_class($element['#status']) . '">';
if ($element['#status'] != HOSTING_STATUS_NONE) {
$output .= "<div class='message'>" . ($element['#message'] ? $element['#message'] : $element['#default_messages'][$element['#status']]) . "</div>";
}
$components = array(
'summary',
'suggestion',
'configuration',
);
foreach ($components as $key) {
if ($element["#{$key}"] & HOSTING_HELP_ENABLED && !is_null($help[$key])) {
$display_type = _hosting_help_class($element["#{$key}"]);
$output .= "<div class='hosting-help-{$key} {$display_type}'>";
if (!is_array($help[$key])) {
// it is simpler if there's only one way to print the component
$help[$key] = array(
$help[$key],
);
}
if ($element["#{$key}" . '_prefix'] && $element["#{$key}"] & _HOSTING_HELP_CAN_COLLAPSE) {
$output .= '<a href="javascript:void(0)" class="hosting-help-toggle">' . $element["#{$key}" . '_prefix'] . '</a>';
}
$output .= "<div class='hosting-help'><p>" . implode("</p><p>", $help[$key]) . "</p></div>";
$output .= '</div>';
}
}
$output .= '</div>';
if ($element['#heading'] & HOSTING_HELP_ENABLED && $help['title'] && !$element['#title']) {
$element['#title'] = $help['title'];
}
$element['#value'] = $output;
return theme('item', $element);
}