function theme_status_report in Drupal 7
Same name and namespace in other branches
- 5 modules/system/system.module \theme_status_report()
- 6 modules/system/system.admin.inc \theme_status_report()
Returns HTML for the status report.
This theme function is dependent on install.inc being loaded, because that's where the constants are defined.
Parameters
$variables: An associative array containing:
- requirements: An array of requirements/status items. Each requirement
is an associative array containing the following elements:
- title: The name of the requirement.
- value: (optional) The current value (version, time, level, etc).
- description: (optional) The description of the requirement.
- severity: (optional) The requirement's result/severity level, one of:
- REQUIREMENT_INFO: Status information.
- REQUIREMENT_OK: The requirement is satisfied.
- REQUIREMENT_WARNING: The requirement failed with a warning.
- REQUIREMENT_ERROR: The requirement failed with an error.
Related topics
3 theme calls to theme_status_report()
- install_verify_requirements in includes/
install.core.inc - Verifies the requirements for installing Drupal.
- system_status in modules/
system/ system.admin.inc - Menu callback: displays the site status report. Can also be used as a pure check.
- update_check_requirements in ./
update.php - Checks update requirements and reports errors and (optionally) warnings.
File
- modules/
system/ system.admin.inc, line 2587 - Admin page callbacks for the system module.
Code
function theme_status_report($variables) {
$requirements = $variables['requirements'];
$severities = array(
REQUIREMENT_INFO => array(
'title' => t('Info'),
'class' => 'info',
),
REQUIREMENT_OK => array(
'title' => t('OK'),
'class' => 'ok',
),
REQUIREMENT_WARNING => array(
'title' => t('Warning'),
'class' => 'warning',
),
REQUIREMENT_ERROR => array(
'title' => t('Error'),
'class' => 'error',
),
);
$output = '<table class="system-status-report">';
foreach ($requirements as $requirement) {
if (empty($requirement['#type'])) {
$severity = $severities[isset($requirement['severity']) ? (int) $requirement['severity'] : REQUIREMENT_OK];
$severity['icon'] = '<div title="' . $severity['title'] . '"><span class="element-invisible">' . $severity['title'] . '</span></div>';
// The requirement's 'value' key is optional, provide a default value.
$requirement['value'] = isset($requirement['value']) ? $requirement['value'] : '';
// Output table row(s)
if (!empty($requirement['description'])) {
$output .= '<tr class="' . $severity['class'] . ' merge-down"><td class="status-icon">' . $severity['icon'] . '</td><td class="status-title">' . $requirement['title'] . '</td><td class="status-value">' . $requirement['value'] . '</td></tr>';
$output .= '<tr class="' . $severity['class'] . ' merge-up"><td colspan="3" class="status-description">' . $requirement['description'] . '</td></tr>';
}
else {
$output .= '<tr class="' . $severity['class'] . '"><td class="status-icon">' . $severity['icon'] . '</td><td class="status-title">' . $requirement['title'] . '</td><td class="status-value">' . $requirement['value'] . '</td></tr>';
}
}
}
$output .= '</table>';
return $output;
}