Commit 64946d19 authored by webchick's avatar webchick

Revert "Issue #2151095 by joelpittet, longwave | Cottser: Convert theme_admin_page() to Twig."

Sorry, wrong commit credit.

This reverts commit d1653fd0.
parent d1653fd0
...@@ -116,9 +116,7 @@ function template_preprocess_admin_block_content(&$variables) { ...@@ -116,9 +116,7 @@ function template_preprocess_admin_block_content(&$variables) {
} }
/** /**
* Prepares variables for administrative index page templates. * Returns HTML for an administrative page.
*
* Default template: admin-page.html.twig.
* *
* @param $variables * @param $variables
* An associative array containing: * An associative array containing:
...@@ -129,24 +127,40 @@ function template_preprocess_admin_block_content(&$variables) { ...@@ -129,24 +127,40 @@ function template_preprocess_admin_block_content(&$variables) {
* *
* @ingroup themeable * @ingroup themeable
*/ */
function template_preprocess_admin_page(&$variables) { function theme_admin_page($variables) {
$variables['system_compact_link'] = array( $blocks = $variables['blocks'];
'#theme' => 'system_compact_link',
);
$variables['containers'] = array();
$stripe = 0; $stripe = 0;
foreach ($variables['blocks'] as $block) { $container = array();
if (!empty($block['content']['#content'])) {
foreach ($blocks as $block) {
$admin_block = array(
'#theme' => 'admin_block',
'#block' => $block,
);
if ($block_output = drupal_render($admin_block)) {
if (empty($block['position'])) { if (empty($block['position'])) {
// Perform automatic striping. // perform automatic striping.
$block['position'] = ++$stripe % 2 ? 'left' : 'right'; $block['position'] = ++$stripe % 2 ? 'left' : 'right';
} }
$variables['containers'][$block['position']]['blocks'][] = array( if (!isset($container[$block['position']])) {
'#theme' => 'admin_block', $container[$block['position']] = '';
'#block' => $block, }
); $container[$block['position']] .= $block_output;
} }
} }
$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;
} }
/** /**
......
...@@ -196,7 +196,6 @@ function system_theme() { ...@@ -196,7 +196,6 @@ function system_theme() {
'admin_page' => array( 'admin_page' => array(
'variables' => array('blocks' => NULL), 'variables' => array('blocks' => NULL),
'file' => 'system.admin.inc', 'file' => 'system.admin.inc',
'template' => 'admin-page',
), ),
'admin_block' => array( 'admin_block' => array(
'variables' => array('block' => NULL), 'variables' => array('block' => NULL),
......
{#
/**
* @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>
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