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.
I've created a region preprocess function in my Zen sub theme, to add classes via $variables['classes_array'][].
This isn't working, because zen_process() is called right after Zen's own preprocess functions, instead of the ones in my sub theme.
I'm not sure how to fix this in Zen for a patch, but this is how I fixed it in my own theme for now:
<?php /** * Implementation of HOOK_theme(). */ function mysubtheme_theme(&$existing, $type, $theme, $path) { $hooks = zen_theme($existing, $type, $theme, $path); // Override preprocess function suggestions for regions so that zen_process() will be called last. $existing['region']['preprocess functions'] = array( 'template_preprocess', 'zen_preprocess', 'zen_preprocess_region', 'mysubtheme_preprocess', 'mysubtheme_preprocess_region', 'zen_process', ); return $hooks; } /** * Preprocess variables for region.tpl.php. */ function mysubtheme_preprocess_region(&$variables) { // These regions need to be rendered as columns. if ($variables['region'] == 'content_bottom_first' || $variables['region'] == 'content_bottom_second') { $variables['classes_array'][] = 'column'; } }
Comments
Comment #1
maartenverbaarschot CreditAttribution: maartenverbaarschot commentedJust found #1168324: zen_process is called too early
Marking this as a duplicate.