function template_preprocess_admin_page in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/system.admin.inc \template_preprocess_admin_page()
Prepares variables for administrative index page templates.
Default template: admin-page.html.twig.
Parameters
$variables: An associative array containing:
- blocks: An array of blocks to display. Each array should include a 'title', a 'description', a formatted 'content' and a 'position' which will control which container it will be in. This is usually 'left' or 'right'.
File
- core/
modules/ system/ system.admin.inc, line 51 - Admin page callbacks for the system module.
Code
function template_preprocess_admin_page(&$variables) {
$variables['system_compact_link'] = array(
'#type' => 'system_compact_link',
);
$variables['containers'] = array();
$stripe = 0;
foreach ($variables['blocks'] as $block) {
if (!empty($block['content']['#content'])) {
if (empty($block['position'])) {
// Perform automatic striping.
$block['position'] = ++$stripe % 2 ? 'left' : 'right';
}
$variables['containers'][$block['position']]['blocks'][] = array(
'#theme' => 'admin_block',
'#block' => $block,
);
}
}
}