Skip to content

Instantly share code, notes, and snippets.

@jacine
Created November 19, 2011 01:02
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jacine/1378246 to your computer and use it in GitHub Desktop.
Save jacine/1378246 to your computer and use it in GitHub Desktop.
Bye, bye region.tpl.php and block--system--main.tpl.php
<?php
/**
* Implements hook_page_alter().
*/
function mytheme_page_alter(&$page) {
// Remove all the region wrappers.
foreach (element_children($page) as $key => $region) {
if (!empty($page[$region]['#theme_wrappers'])) {
$page[$region]['#theme_wrappers'] = array_diff($page[$region]['#theme_wrappers'], array('region'));
}
}
// Remove the wrapper from the main content block.
if (!empty($page['content']['system_main'])) {
$page['content']['system_main']['#theme_wrappers'] = array_diff($page['content']['system_main']['#theme_wrappers'], array('block'));
}
}
@jacine
Copy link
Author

jacine commented Nov 19, 2011

I like to do this in themes.

  • region.tpl.php is completely useless IMO.
  • block--system--main.tpl.php shouldn't have block wrapper markup because it makes CSS more complicated IMO.

@briangelhaus
Copy link

thanks!

@jleiva
Copy link

jleiva commented Mar 12, 2013

awesome, thanks!

@thulstrup
Copy link

Great tip. Thanks!

@erajuan
Copy link

erajuan commented Dec 21, 2013

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment