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.
Zen already has THEME_preprocess_HOOK() functions, but we missed the THEME_preprocess() function which allows you to insert variables into every template file.
Comments
Comment #1
JohnAlbinCommitted to DRUPAL-5--1.
Comment #2
NikLP CreditAttribution: NikLP commentedJohn,
is this an effective replacement for the generic _phptemplate_variables function? I noted that it was not possible to add variables to page/node/comment in 1.0 unless you did that separately - does this bring back the ol' classic case 'page', etc?
Do you have a quick example snippet...? :)
Thanks.
Comment #3
JohnAlbinJust to clarify for those playing at home, this change simply adds a
SUBTHEME_preprocess(&$vars, $hook)
function to the STARTERKIT/template.php file. Drupal 6 has this preprocess function, so Zen should too.I hope not! The SUBTHEME_preprocess() function should only be used in the special case where you want to add the same variable to every template file.
You can see example code in the just released Zen 5.x-1.1. There’s also 1.0->1.1 upgrade instructions online.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.