Skip to content

Instantly share code, notes, and snippets.

@EclipseGc
Created September 20, 2012 16:21
Show Gist options
  • Save EclipseGc/3756889 to your computer and use it in GitHub Desktop.
Save EclipseGc/3756889 to your computer and use it in GitHub Desktop.
<?php
function layout_page_pre_render($page) {
global $theme;
// @todo Don't hard-code the bartik__bartik layout; let that be administrator
// configurable.
if ($theme == 'bartik') {
$layout_manager = drupal_container()->get('plugin.manager.layout');
$conf = array(
'regions' => array(
'content' => array(
'plugin.core.block.bartik.main_content' => array(),
),
'help' => array(
'plugin.core.block.bartik.help_text' => array(),
),
'sidebar_first' => array(
'plugin.core.block.bartik.search_form' => array(),
'plugin.core.block.bartik.user_login' => array(),
'plugin.core.block.bartik.user_online' => array(),
),
'sidebar_second' => array(
'plugin.core.block.bartik.user_menu' => array(),
),
'footer' => array(
'plugin.core.block.bartik.powered_by' => array(),
),
)
);
/*$conf['regions']['sidebar_first']['user_online_block'] = array(
'subject' => t("Who else is online"),
'seconds_online' => 450,
'max_list_count' => 5,
);*/
$layout = $layout_manager->createInstance('default_layout:bartik__bartik', $conf);
$regions = array();
// When drupal_render_page() goes away, so will this, but in the meantime,
// this is how we replace page.tpl.php with the layout.
$page['#children'] = $layout->renderLayout(FALSE, $regions);
$page['#theme'] = NULL;
}
return $page;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment