hi
after i have inserted the node_style_return_vars line into my template.php the $vars set with $region vars are lost. check out the following example i'm using:
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
// Load region content assigned via drupal_set_content().
foreach (array('example_region1','example_region2') as $region) {
$variables[$region] = drupal_get_content($region);
}
break;
}
// node_style module is installed and active
if (function_exists('node_style_return_vars')) {
return node_style_return_vars($hook, $vars);
}
else {
return $vars;
}
}
it looks like there are some variables naming bugs in the node_style_return_vars function. I have corrected them and the following fixes this bugs:
/**
* Returns a PHPTemplate variables array based on $hook. Called from node_style.inc.
*
* @see _phptemplate_variables
*/
function node_style_return_vars($hook, $vars = array()) {
global $node_style;
$scheme = $node_style['variables'];
if (isset($vars['node']) && isset($scheme['display'][$hook])) {
foreach ($scheme['display'][$hook] as $var) {
$vars[$var] = '';
}
}
if ($hook == 'page') {
// Rather than appending to "head", append to styles, thereby allowing for
// overrides of existing stylesheets.
$vars['styles'] = $vars['styles'] . trim($scheme['misc']['head']);
}
return $vars;
}
here are the diffs:
@@ -322 +322 @@
-function node_style_return_vars($hook, $variables) {
+function node_style_return_vars($hook, $vars = array()) {
@@ -325,2 +324,0 @@
- $vars = array();
-
@@ -328 +326 @@
- if (isset($variables['node']) && isset($scheme['display'][$hook])) {
+ if (isset($vars['node']) && isset($scheme['display'][$hook])) {
@@ -336 +334 @@
- $vars['styles'] = $variables['styles'] . trim($scheme['misc']['head']);
+ $vars['styles'] = $vars['styles'] . trim($scheme['misc']['head']);
are you able to fix this soon, please?
Comments
Comment #1
hass commentedAre you able to fix this Bug and release a new version? I'd like to remove the hotfix from my website...
Comment #2
hass commentedComment #3
hass commentedComment #4
Zen commentedCommitted to HEAD with minor modifications. Please test and reopen issue if necessary.
Thanks mate.
-K
Comment #5
(not verified) commented