From 64946d19e0888958dc32bc29a04e6cdb57a5a682 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Wed, 12 Mar 2014 12:20:22 -0700 Subject: [PATCH] Revert "Issue #2151095 by joelpittet, longwave | Cottser: Convert theme_admin_page() to Twig." Sorry, wrong commit credit. This reverts commit d1653fd046cc53b1a3a2bafe5868cf7ca98a32b5. --- core/modules/system/system.admin.inc | 44 ++++++++++++------- core/modules/system/system.module | 1 - .../system/templates/admin-page.html.twig | 26 ----------- 3 files changed, 29 insertions(+), 42 deletions(-) delete mode 100644 core/modules/system/templates/admin-page.html.twig diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 75f1c60994f8..1ce2b9ef0838 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -116,9 +116,7 @@ function template_preprocess_admin_block_content(&$variables) { } /** - * Prepares variables for administrative index page templates. - * - * Default template: admin-page.html.twig. + * Returns HTML for an administrative page. * * @param $variables * An associative array containing: @@ -129,24 +127,40 @@ function template_preprocess_admin_block_content(&$variables) { * * @ingroup themeable */ -function template_preprocess_admin_page(&$variables) { - $variables['system_compact_link'] = array( - '#theme' => 'system_compact_link', - ); - $variables['containers'] = array(); +function theme_admin_page($variables) { + $blocks = $variables['blocks']; + $stripe = 0; - foreach ($variables['blocks'] as $block) { - if (!empty($block['content']['#content'])) { + $container = array(); + + foreach ($blocks as $block) { + $admin_block = array( + '#theme' => 'admin_block', + '#block' => $block, + ); + if ($block_output = drupal_render($admin_block)) { if (empty($block['position'])) { - // Perform automatic striping. + // perform automatic striping. $block['position'] = ++$stripe % 2 ? 'left' : 'right'; } - $variables['containers'][$block['position']]['blocks'][] = array( - '#theme' => 'admin_block', - '#block' => $block, - ); + if (!isset($container[$block['position']])) { + $container[$block['position']] = ''; + } + $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; } /** diff --git a/core/modules/system/system.module b/core/modules/system/system.module index ca908a2792dd..6caca8af9a4d 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -196,7 +196,6 @@ function system_theme() { 'admin_page' => array( 'variables' => array('blocks' => NULL), 'file' => 'system.admin.inc', - 'template' => 'admin-page', ), 'admin_block' => array( 'variables' => array('block' => NULL), diff --git a/core/modules/system/templates/admin-page.html.twig b/core/modules/system/templates/admin-page.html.twig deleted file mode 100644 index 73cae67c1635..000000000000 --- a/core/modules/system/templates/admin-page.html.twig +++ /dev/null @@ -1,26 +0,0 @@ -{# -/** - * @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> -- GitLab