function template_preprocess_system_admin_index

template_preprocess_system_admin_index(&$variables)

Prepares variables for admin index templates.

Default template: system-admin-index.html.twig.

Parameters

$variables: An associative array containing:

  • menu_items: An array of modules to be displayed.

File

core/modules/system/system.admin.inc, line 80
Admin page callbacks for the system module.

Code

function template_preprocess_system_admin_index(&$variables) {
  $variables['system_compact_link'] = array(
    '#type' => 'system_compact_link',
  );
  $variables['containers'] = array();
  $stripe = 0;
  // Iterate over all modules.
  foreach ($variables['menu_items'] as $module => $block) {
    list($description, $items) = $block;
    $position = ++$stripe % 2 ? 'left' : 'right';
    // Output links.
    if (count($items)) {
      $variables['containers'][$position][] = array(
        '#theme' => 'admin_block',
        '#block' => array(
          'position' => $position,
          'title' => $module,
          'content' => array(
            '#theme' => 'admin_block_content',
            '#content' => $items,
          ),
          'description' => t($description),
        ),
      );
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!system!system.admin.inc/function/template_preprocess_system_admin_index/8.1.x