+
+
diff --git a/panels-layouts/zen_page_default/zen_page_default.inc b/panels-layouts/zen_page_default/zen_page_default.inc
new file mode 100644
index 0000000..dd4c53a
--- /dev/null
+++ b/panels-layouts/zen_page_default/zen_page_default.inc
@@ -0,0 +1,15 @@
+ t('Zen page template'),
+ 'category' => t('Site templates'),
+ 'icon' => 'icon.png',
+ 'theme' => 'zen_page_default',
+ 'regions' => array(
+ 'page_top' => t('Page top'),
+ 'header' => t('Header'),
+ 'main' => t('Main'),
+ 'footer' => t('Footer'),
+ 'page_bottom' => t('Page bottom'),
+ ),
+);
diff --git a/template.php b/template.php
index 077d0b5..67bcde8 100644
--- a/template.php
+++ b/template.php
@@ -173,6 +173,27 @@ function zen_preprocess_html(&$variables, $hook) {
if (theme_get_setting('zen_wireframes')) {
$variables['classes_array'][] = 'with-wireframes'; // Optionally add the wireframes style.
}
+
+ // Add Panels classes that were added by a layout specific preprocess.
+ // If Block module is disabled while using Panels the class will be set to
+ // 'no-sidebars', which migt be wrong.
+ // If Block module is enabled while using Panels the class will be set to
+ // what's configured for the theme, which might be wrong.
+ // We need to override this with what the actual Panels layout reflects.
+ //
+ // @see zen_preprocess_zen_main_default().
+ $panels_classes_array = drupal_static('zen_panels_classes_array', array());
+ if (!empty($panels_classes_array)) {
+ // Search the keys representing the sidebar state that we should remove.
+ foreach ($variables['classes_array'] as $key => $class) {
+ if (in_array($class, array('two-sidebars', 'one-sidebar sidebar-first', 'one-sidebar sidebar-second', 'no-sidebars'))) {
+ unset($variables['classes_array'][$key]);
+ }
+ }
+ // Merge in the classes from the Panels layout.
+ $variables['classes_array'] = array_merge($variables['classes_array'], $panels_classes_array);
+ }
+
// Store the menu item since it has some useful information.
$variables['menu_item'] = menu_get_item();
if ($variables['menu_item']) {
@@ -700,3 +721,99 @@ function zen_mark($variables) {
function zen_panels_default_style_render_region($variables) {
return implode('', $variables['panes']);
}
+
+/**
+ * Preprocess variables for zen-main-default.tpl.php.
+ *
+ * Because of Panels' inside-out rendering method we can only detect empty
+ * sidebars at this stage. We then set a static variable so that we can add
+ * the appropriate body classes later.
+ */
+function zen_preprocess_zen_main_default(&$variables) {
+ $classes = &drupal_static('zen_panels_classes_array', array());
+ if (!empty($variables['content']['sidebar_first']) && !empty($variables['content']['sidebar_second'])) {
+ $classes[] = 'two-sidebars';
+ }
+ elseif (!empty($variables['content']['sidebar_first'])) {
+ $classes[] = 'one-sidebar sidebar-first';
+ }
+ elseif (!empty($variables['content']['sidebar_second'])) {
+ $classes[] = 'one-sidebar sidebar-second';
+ }
+ else {
+ $classes[] = 'no-sidebars';
+ }
+}
+
+/**
+ * Preprocess variables for panels-pane.tpl.php.
+ */
+function zen_preprocess_panels_pane(&$variables) {
+ // Use a template with no wrapper for certain page elements.
+ switch ($variables['pane']->subtype) {
+ case 'page_content':
+ case 'pane_header':
+ case 'pane_navigation':
+ case 'pane_messages':
+ $variables['theme_hook_suggestions'][] = 'panels_pane__no_wrapper';
+ break;
+ }
+
+ // Set classes on panes similar to blocks.
+ $default_classes_array = array(
+ 'block',
+ 'block-' . drupal_clean_css_identifier($variables['pane']->subtype),
+ $variables['zebra'],
+ );
+ $variables['classes_array'] = array_merge($default_classes_array, $variables['pane']->css);
+
+ $variables['title_attributes_array']['class'] = array(
+ 'block-title',
+ );
+}
+
+/**
+ * Process variables for panels-pane.tpl.php.
+ */
+function zen_process_panels_pane(&$variables) {
+ $variables['classes'] = implode(' ', $variables['classes_array']);
+ $variables['title_attributes'] = drupal_attributes($variables['title_attributes_array']);
+}
+
+/**
+ * Process variables for pane-navigation.tpl.php.
+ */
+function zen_process_pane_navigation(&$variables) {
+ $variables['main_menu'] = menu_main_menu();
+}
+
+/**
+ * Process variables for pane-messages.tpl.php.
+ */
+function zen_preprocess_pane_messages(&$variables) {
+ $variables['breadcrumb'] = theme('breadcrumb', array('breadcrumb' => drupal_get_breadcrumb()));
+ // Use CTools callback tokens to get around rendering order problems with
+ // elements that are likely to be overridden by Panels.
+ $variables['title'] = ctools_set_callback_token('title', array('zen_ctools_callback_token_title', '