From Michelle: Request to themers.
Michelle asked me to send this on for her, as her email is acting up. -- Susan (HedgeMage) ======================================================================== If you maintain a theme on drupal.org, please read this. The Advanced Forum module needs to hook into _phptemplate_variables to work. I've done my best to minimize what needs to be merged by moving the bulk of it into a function. So all the user needs to add is this: if (module_exists('advanced_forum')) { $vars = advanced_forum_addvars($hook, $vars); } But even adding those three lines is hard for people who don't know anything about code. The problem is that _phptemplate_variables varies from theme to theme. Some themes don't have it at all and some have rather complex functions. My readme says to put those lines at the very top, which will usually work. But then there's themes like Garland that stick the "return $vars;" inside the "page" case and return just "array()" for everything else! So then I have to explain that $vars needs to get returned for all cases. This gets to be a big support pain trying to help people make this work with every possible theme out there. So what would be really, really awesome for me and for any other module maintainer that needs to add to _phptemplate_variables is if the theme maintainers would be willing to always return $vars from the function even if you only use a particular case in there. I'm not aware of any problems with just returning the $vars that is passed in to the function to begin with so it shouldn't affect your themes any and will make life easier for your users that need to add to the function. Of course, if you want to be really super helpful to me, you could add the advanced forum call right to the themes so the user doesn't have to do any merging. But I realize that's a lot to ask. :) Thanks, Michelle
On Dec 16, 2007 3:42 AM, Susan Stewart <HedgeMage@binaryredneck.net> wrote:
Michelle asked me to send this on for her, as her email is acting up.
-- Susan (HedgeMage)
Of course, if you want to be really super helpful to me, you could add the advanced forum call right to the themes so the user doesn't have to do any merging. But I realize that's a lot to ask. :)
Susan / Michelle: this all gets much better in Drupal 6, and you will be able to add variables to whatever theme hook you desire in a module, without touching a module, so this problem will go away with the Drupal 6 port of advanced forum :) Gabor
Why not have them rename the original to, say, _phptemplate_variables_original(), and then add a new _phptemplate_variables() that calls the original and adds more stuff to it? That way you get the original's variables no matter how it returns them. function _phptemplate_variables($hook, $vars) { $vars = array(); if (function_exists('_phptemplate_variables_original')) { $vars = _phptemplate_variables_original($hook, $vars); } if (module_exists('advanced_forum')) { $vars = advanced_forum_addvars($hook, $vars); } return $vars; } -john
participants (3)
-
Gábor Hojtsy -
John Morahan -
Susan Stewart