Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
288
Merge Requests
288
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
d1653fd0
Commit
d1653fd0
authored
Mar 12, 2014
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2151095
by joelpittet, longwave | Cottser: Convert theme_admin_page() to Twig.
parent
c26bf7ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
29 deletions
+42
-29
core/modules/system/system.admin.inc
core/modules/system/system.admin.inc
+15
-29
core/modules/system/system.module
core/modules/system/system.module
+1
-0
core/modules/system/templates/admin-page.html.twig
core/modules/system/templates/admin-page.html.twig
+26
-0
No files found.
core/modules/system/system.admin.inc
View file @
d1653fd0
...
...
@@ -116,7 +116,9 @@ function template_preprocess_admin_block_content(&$variables) {
}
/**
* Returns HTML for an administrative page.
* Prepares variables for administrative index page templates.
*
* Default template: admin-page.html.twig.
*
* @param $variables
* An associative array containing:
...
...
@@ -127,40 +129,24 @@ function template_preprocess_admin_block_content(&$variables) {
*
* @ingroup themeable
*/
function
theme_admin_page
(
$variables
)
{
$blocks
=
$variables
[
'blocks'
];
function
template_preprocess_admin_page
(
&
$variables
)
{
$variables
[
'system_compact_link'
]
=
array
(
'#theme'
=>
'system_compact_link'
,
);
$variables
[
'containers'
]
=
array
();
$stripe
=
0
;
$container
=
array
();
foreach
(
$blocks
as
$block
)
{
$admin_block
=
array
(
'#theme'
=>
'admin_block'
,
'#block'
=>
$block
,
);
if
(
$block_output
=
drupal_render
(
$admin_block
))
{
foreach
(
$variables
[
'blocks'
]
as
$block
)
{
if
(
!
empty
(
$block
[
'content'
][
'#content'
]))
{
if
(
empty
(
$block
[
'position'
]))
{
//
p
erform automatic striping.
//
P
erform automatic striping.
$block
[
'position'
]
=
++
$stripe
%
2
?
'left'
:
'right'
;
}
if
(
!
isset
(
$container
[
$block
[
'position'
]]))
{
$container
[
$block
[
'position'
]]
=
''
;
}
$container
[
$block
[
'position'
]]
.
=
$block_output
;
$variables
[
'containers'
][
$block
[
'position'
]][
'blocks'
][]
=
array
(
'#theme'
=>
'admin_block'
,
'#block'
=>
$block
,
)
;
}
}
$system_compact_link
=
array
(
'#theme'
=>
'system_compact_link'
);
$output
=
'<div class="admin clearfix">'
;
$output
.
=
drupal_render
(
$system_compact_link
);
foreach
(
$container
as
$id
=>
$data
)
{
$output
.
=
'<div class="'
.
$id
.
' clearfix">'
;
$output
.
=
$data
;
$output
.
=
'</div>'
;
}
$output
.
=
'</div>'
;
return
$output
;
}
/**
...
...
core/modules/system/system.module
View file @
d1653fd0
...
...
@@ -196,6 +196,7 @@ function system_theme() {
'admin_page'
=>
array
(
'variables'
=>
array
(
'blocks'
=>
NULL
),
'file'
=>
'system.admin.inc'
,
'template'
=>
'admin-page'
,
),
'admin_block'
=>
array
(
'variables'
=>
array
(
'block'
=>
NULL
),
...
...
core/modules/system/templates/admin-page.html.twig
0 → 100644
View file @
d1653fd0
{#
/**
* @file
* Default theme implementation for an administrative page.
*
* Available variables:
* - system_compact_link: Themed link to toggle compact view.
* - containers: An list of administrative blocks keyed by position: left or
* right. Contains:
* - blocks: A list of blocks within a container.
*
* @see template_preprocess_admin_page()
*
* @ingroup themeable
*/
#}
<div
class=
"admin clearfix"
>
{{
system_compact_link
}}
{%
for
position
,
container
in
containers
%}
<div
class=
"
{{
position
}}
clearfix"
>
{%
for
block
in
container.blocks
%}
{{
block
}}
{%
endfor
%}
</div>
{%
endfor
%}
</div>
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