You could do this through a very simple custom module. This way hiding the region will work with any theme, as long as it has the same name of the region you are trying to hide.
Here's the code that would go into your sample.info
file:
name = Module name
description = Module description
package = Custom
core = 7.x
version = 7.x-1.0
Create sample.module
file and add the following code:
function sample_page_alter(&$page) {
// Fetch the node object.
$node = menu_get_object();
// Perform some checks to make sure this is the page we want to alter.
if (
// We are on node page.
$node &&
// Check if the node if of type you want to have 100% wide layout.
$node->type == 'page' &&
// This will exclude local node tasks, such as edit, delete and revision.
!arg(2)
) {
// Unset the region you want to hide.
unset($page['sidebar_first']);
}
}
Update
You asked for a wildcard that would work across multiple themes.
First off - the sidebar_first
and sidebar_second
are somewhat standard names for left/right sidebars in Drupal themes. Most of the themes will name sidebars the same way.
However, for the sake of answering the question, here's how you'd "scan" for all regions that contain for example the word "sidebar":
function sample_page_alter(&$page) {
// Fetch the node object.
$node = menu_get_object();
// Perform some checks to make sure this is the page we want to alter.
if (
// We are on node page.
$node &&
// Check if the node if of type you want to have 100% wide layout.
$node->type == 'page' &&
// This will exclude local node tasks, such as edit, delete and revision.
!arg(2)
) {
// Unset the sidebar regions.
//
// We will loop through the elements and check if they are set and contain
// the word "sidebar".
foreach (element_children($page) as $region_name) {
if (strpos($region_name, 'sidebar') !== FALSE && !empty($page[$region_name])) {
unset($page[$region_name]);
}
}
}
}
Notes
Do take into consideration that the above approach will just prevent the region from being printed on the screen. This means that if you have complex blocks, they will still be rendered and take server resources.
You can replace all instances of sample
with whatever else you want to call your module.
For more information, check out the following:
Hope this helps.