Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
6d5899ec
Commit
6d5899ec
authored
Jan 25, 2014
by
webchick
Browse files
Issue
#2151101
by joelpittet: Convert theme_status_report() to Twig.
parent
c84a43d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/system/system.admin.inc
View file @
6d5899ec
...
...
@@ -268,7 +268,9 @@ function theme_system_admin_index($variables) {
}
/**
* Returns HTML for the status report.
* Prepares variables for status report template.
*
* Default template: status-report.html.twig.
*
* This theme function is dependent on install.inc being loaded, because
* that's where the constants are defined.
...
...
@@ -288,8 +290,7 @@ function theme_system_admin_index($variables) {
*
* @ingroup themeable
*/
function
theme_status_report
(
$variables
)
{
$requirements
=
$variables
[
'requirements'
];
function
template_preprocess_status_report
(
&
$variables
)
{
$severities
=
array
(
REQUIREMENT_INFO
=>
array
(
'title'
=>
t
(
'Info'
),
...
...
@@ -308,11 +309,8 @@ function theme_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
(
$requirements
as
$requirement
)
{
foreach
(
$
variables
[
'
requirements
'
]
as
$i
=>
$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
...
...
@@ -326,29 +324,9 @@ function theme_status_report($variables) {
else
{
$severity
=
$severities
[
REQUIREMENT_INFO
];
}
// 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>'
;
$variables
[
'requirements'
][
$i
][
'severity_class'
]
=
$severity
[
'class'
];
$variables
[
'requirements'
][
$i
][
'severity_title'
]
=
$severity
[
'title'
];
}
$output
.
=
'</tbody></table>'
;
return
$output
;
}
/**
...
...
core/modules/system/system.module
View file @
6d5899ec
...
...
@@ -177,6 +177,7 @@ function system_theme() {
'status_report'
=>
array
(
'variables'
=>
array
(
'requirements'
=>
NULL
),
'file'
=>
'system.admin.inc'
,
'template'
=>
'status-report'
,
),
'admin_page'
=>
array
(
'variables'
=>
array
(
'blocks'
=>
NULL
),
...
...
core/modules/system/templates/status-report.html.twig
0 → 100644
View file @
6d5899ec
{#
/**
* 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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment