When Panels Everywhere would be too much, there is a way to override Drupal’s page template for pages powered by Panels, leaving a more robust template for system pages.
I frequently use Panels for system and custom pages. In page.tpl.php
,
the whole Panels layout is dumped into the $content
variable in the primary
block region, which may not serve the needs of the design. My custom Panels
layouts often built on the UI defined in page.tpl.php
, so I like
using an alternate template suggestion for those pages which has less structure,
leaving Panels more freedom to take over the page completely.
<?php
/**
* Implements theme_preprocess_page()
*/
function tsmithcreative_preprocess_page(&$variables) {
// Call a stripped down "page--panel.tpl.php" when Panels
// covers the entire layout. Otherwise, the standard
// page.tpl.php contains the two column structure with
// Drupal's block layout.
$panel = panels_get_current_page_display();
if ( isset($panel) && !empty($panel->layout) ) {
$variables['theme_hook_suggestions'][] = 'page__panel';
}
}
- Published
- August 22, 2013
- Tags