diff --git a/template.php b/template.php index 61a1f8f..44734fa 100644 --- a/template.php +++ b/template.php @@ -473,6 +473,40 @@ function zen_preprocess_block(&$variables, $hook) { } /** + * Override or insert variables into the panel-pane templates. + * + * @param $variables + * An array of variables to pass to the theme template. + * @param $hook + * The name of the template being rendered ("panel-pane" in this case.) + */ +function zen_preprocess_panels_pane(&$variables) { + // Give sidebar panel-panes and extra class for less specificity. This only works if you use default sidebars php in panel layout tpl + // This keep you away from .sidebars .panel-pane or #content .panel-pane + if (isset($variables['pane']->panel) && ($variables['pane']->panel == 'sidebar_first' || $variables['pane']->panel == 'sidebar_second')) { + $variables['classes_array'][] = 'sidebar-panel-pane'; + } + + // Add odd, even, first and last classes to panes. + $panel = $variables['pane']->panel; + $count = count($variables['display']->panels[$panel]); + + if ($variables['pane']->position % 2) { + $variables['classes_array'][] = 'odd'; + } + else { + $variables['classes_array'][] = 'even'; + } + if ($variables['pane']->position == 0) { + $variables['classes_array'][] = 'first'; + } + if ($variables['pane']->position == $count - 1) { + $variables['classes_array'][] = 'last'; + } +} + + +/** * Override or insert variables into the block templates. * * @param $variables