I have a sub-theme which implements subtheme_preprocess_region(), and in there I add some classes to the classes array. However, these classes are not added to my region markup. I think it's because Zen does all it's stuff before my sub-theme adds these classes.

It appears that the functions get executed in the following order:

zen_preprocess
zen_preprocess_region
zen_process (this is where the classes array get joined)
subtheme_preprocess
subtheme_preprocess_region (this is where I'm adding the classes)

Based on how the same thing works for blocks, I would expect that the subtheme preprocess functions would execute before zen_process. Here's the order the block functions are executed:

zen_preprocess
zen_preprocess_block
subtheme_preprocess
subtheme_preprocess_block
zen_process
zen_process_block

Am I missing something? Is this by design, or should the subtheme region functions be called before zen_process?

Files: 

Comments

Title:Adding region classesCan't add classes in subtheme_preprocess_region()

I experienced this too. I don't think it's by design, as it does work as expected with node and block preprocessors. (Marked #1181184: zen_process() is called before mysubtheme_preprocess_region() as a duplicate of this issue)

Title:Can't add classes in subtheme_preprocess_region()zen_process is called too early
Priority:Normal» Major

This is my first patch regarding the theme registry, so beware.

I noticed the process functions get called again later, when we loop through existing hook, so I guess we can safely remove from the array added by default to theme_region. Thus, when it gets added, all of the preprocess functions are already added.

I have changed the priority of this bug to major, since it breaks a d7 functionality Zen backports.

StatusFileSize
new785 bytes

Status:Active» Needs review

this is one of those days.

Component:PHP code» layout.css
Status:Needs review» Needs work