Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By surfgatinho on
I'm using the dev version of the latest Zurb foundation theme, but I don't think it is a theme specific issue.
A few variables for column classes are set in PARENT_THEME_preprocess_page() along with some other stuff. If I try to override in my sub theme below it doesn't apply.
However, if I comment out the corresponding section of code in the parent theme ( which is obviously bad practice) it does work.
Here's my sub-theme template.php code:
function THEME_preprocess_page(&$variables) {
// Convenience variables
if (!empty($variables['page']['sidebar_first'])){
$left = $variables['page']['sidebar_first'];
}
if (!empty($variables['page']['sidebar_second'])) {
$right = $variables['page']['sidebar_second'];
}
// Dynamic sidebars
if (!empty($left) && !empty($right)) {
$variables['main_wrapper'] = 'large-13 large-push-3';
$variables['main_grid'] = 'large-10';
$variables['sidebar_first_grid'] = 'large-3 large-pull-13';
$variables['sidebar_sec_grid'] = 'large-6';
} elseif (empty($left) && !empty($right)) {
$variables['main_wrapper'] = 'large-16';
$variables['main_grid'] = 'large-11';
$variables['sidebar_first_grid'] = '';
$variables['sidebar_sec_grid'] = 'large-5';
} elseif (!empty($left) && empty($right)) {
$variables['main_wrapper'] = 'large-12 large-push-4';
$variables['main_grid'] = 'large-16';
$variables['sidebar_first_grid'] = 'large-4 large-pull-12';
$variables['sidebar_sec_grid'] = '';
} else {
$variables['main_wrapper'] = 'large-16';
$variables['main_grid'] = 'large-16';
$variables['sidebar_first_grid'] = '';
$variables['sidebar_sec_grid'] = '';
}
}
Any ideas?
Thanks,
Chris
Comments
What variable are you trying
What variable are you trying to override, how is it being set in the parent theme, what is the code you are using to override that in your sub theme, and what is the output for that variable?