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?
Comment | File | Size | Author |
---|---|---|---|
#3 | zen-zen_preprocess-called-too-early.patch | 785 bytes | barraponto |
Comments
Comment #1
maartenverbaarschot CreditAttribution: maartenverbaarschot commentedI 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)
Comment #2
barraponto CreditAttribution: barraponto commentedThis 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.
Comment #3
barraponto CreditAttribution: barraponto commentedComment #4
barraponto CreditAttribution: barraponto commentedthis is one of those days.
Comment #5
JohnAlbinComment #6
mvdve CreditAttribution: mvdve commentedI experience the same issue (i think... still not sure what is happening).
The preprocess function of my panels layout does not get run all the time. There is a static variable set within this function (with panels everywhere) and it is not always set. In this case, the complete preprocess function of the panels layout is not activated.
Comment #7
JohnAlbin