Commit 297972ba authored by webchick's avatar webchick

Revert "Issue #2151101 by joelpittet: Convert theme_status_report() to Twig."

Oops. Wrong commit credit.

This reverts commit 6d5899ec.
parent 6d5899ec
......@@ -268,9 +268,7 @@ function theme_system_admin_index($variables) {
}
/**
* Prepares variables for status report template.
*
* Default template: status-report.html.twig.
* Returns HTML for the status report.
*
* This theme function is dependent on install.inc being loaded, because
* that's where the constants are defined.
......@@ -290,7 +288,8 @@ function theme_system_admin_index($variables) {
*
* @ingroup themeable
*/
function template_preprocess_status_report(&$variables) {
function theme_status_report($variables) {
$requirements = $variables['requirements'];
$severities = array(
REQUIREMENT_INFO => array(
'title' => t('Info'),
......@@ -309,8 +308,11 @@ function template_preprocess_status_report(&$variables) {
'class' => 'error',
),
);
$output = '<table class="system-status-report"><thead><tr class="visually-hidden">';
$output .= '<th>' . t('Status') . '</th><th>' . t('Component') . '</th><th>' . t('Details') . '</th>';
$output .= '</tr></thead><tbody>';
foreach ($variables['requirements'] as $i => $requirement) {
foreach ($requirements as $requirement) {
// Always use the explicit requirement severity, if defined. Otherwise,
// default to REQUIREMENT_OK in the installer to visually confirm that
// installation requirements are met. And default to REQUIREMENT_INFO to
......@@ -324,9 +326,29 @@ function template_preprocess_status_report(&$variables) {
else {
$severity = $severities[REQUIREMENT_INFO];
}
$variables['requirements'][$i]['severity_class'] = $severity['class'];
$variables['requirements'][$i]['severity_title'] = $severity['title'];
// hook_requirements does not require value to be set. Set to null if not:
if (isset($requirement['value'])) {
$value = $requirement['value'];
}
else {
$value = NULL;
}
$severity['icon'] = '<div title="' . $severity['title'] . '"><span class="visually-hidden">' . $severity['title'] . '</span></div>';
// Output table rows.
$output .= '<tr class="' . $severity['class'] . '">';
$output .= '<td class="status-icon">' . $severity['icon'] . '</td>';
$output .= '<td class="status-title">' . $requirement['title'] . '</td>';
$output .= '<td class="status-value">' . $value;
if (!empty($requirement['description'])) {
$output .= '<div class="description">' . $requirement['description'] . '</div>';
}
$output .= '</td></tr>';
}
$output .= '</tbody></table>';
return $output;
}
/**
......
......@@ -177,7 +177,6 @@ function system_theme() {
'status_report' => array(
'variables' => array('requirements' => NULL),
'file' => 'system.admin.inc',
'template' => 'status-report',
),
'admin_page' => array(
'variables' => array('blocks' => NULL),
......
{#
/**
* Default theme implementation for the status report.
*
* Available variables:
* - requirements: Contains multiple requirement instances.
* Each requirement contains:
* - title: The title of the requirement.
* - value: (optional) The requirement's status.
* - description: (optional) The requirement's description.
* - severity_title: The title of the severity.
* - severity_class: The HTML class of the severity.
*
* @see template_preprocess_status_report()
*
* @ingroup themeable
*/
#}
<table class="system-status-report">
<thead>
<tr class="visually-hidden">
<th>{{ 'Status'|t }}</th><th>{{ 'Component'|t }}</th><th>{{ 'Details'|t }}</th>
</tr>
</thead>
<tbody>
{% for requirement in requirements %}
<tr class="{{ requirement.severity_class }}">
<td class="status-icon">
<div title="{{ requirement.severity_title }}">
<span class="visually-hidden">{{ requirement.severity_title }}</span>
</div>
</td>
<td class="status-title">{{ requirement.title }}</td>
<td class="status-value">
{{ requirement.value }}
{% if requirement.description %}
<div class="description">{{ requirement.description }}</div>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment