diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 3af30c8..604b73b 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -403,7 +403,9 @@ function theme_admin_page($variables) { } /** - * Returns HTML for the output of the admin index page. + * Prepares variables for admin index template. + * + * Default template: system-admin-index.html.twig. * * @param $variables * An associative array containing: @@ -411,55 +413,35 @@ function theme_admin_page($variables) { * * @ingroup themeable */ -function theme_system_admin_index($variables) { - $menu_items = $variables['menu_items']; - - $container = array('left' => '', 'right' => ''); - $flip = array('left' => 'right', 'right' => 'left'); - $position = 'left'; - +function template_preprocess_system_admin_index(&$variables) { + $variables['system_compact_link'] = array( + '#theme' => 'system_compact_link' + ); + $variables['containers'] = array(); + $stripe = 0; // Iterate over all modules. - foreach ($menu_items as $module => $block) { + foreach ($variables['menu_items'] as $module => $block) { list($description, $items) = $block; - + $position = ++$stripe % 2 ? 'left' : 'right'; // Output links. if (count($items)) { - $admin_block_content = array( - '#theme' => 'admin_block_content', - '#content' => $items, - ); - $block = array(); - $block['title'] = $module; - $block['content'] = drupal_render($admin_block_content); - $block['description'] = t($description); - $block['show'] = TRUE; - $admin_block = array( + $variables['containers'][$position]['blocks'][] = array( '#theme' => 'admin_block', - '#block' => $block, + '#block' => array( + 'position' => $position, + 'title' => $module, + 'show' => TRUE, + 'content' => array( + '#theme' => 'admin_block_content', + '#content' => $items, + ), + 'description' => t($description), + ), ); - if ($block_output = drupal_render($admin_block)) { - if (!isset($block['position'])) { - // Perform automatic striping. - $block['position'] = $position; - $position = $flip[$position]; - } - $container[$block['position']] .= $block_output; - } - } - } - $system_compact_link = array('#theme' => 'system_compact_link'); - $output = '