Closed (duplicate)
Project:
Vote Up/Down
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
17 Mar 2010 at 15:46 UTC
Updated:
29 Jun 2010 at 03:56 UTC
I've created a custom Vote Up/Down widget based on the instructions in WIDGETAPI.txt. However, I can't figure out where to do preprocessing for the widget template. I have some code that calculates the upvotes and downvotes separately, and I'd like to avoid putting that code directly in widget.tpl.php. Is there a widget preprocess hook that I'm overlooking? My theme's hook_preprocess does not seem to get called for the widget.
I know this isn't strictly a Vote Up/Down issue - let me know if there's a better place for this.
Comments
Comment #1
marvil07 commentedYou are right, since we are using plugins for this, and we call the render function directly there is not time for making preproces as in theme system :-/
But, for now, you can manually change the
render functionitem on your widget definition(athook_vud_widgets()), so there you can call an own function to do preprocess and then call the expectedtheme_render_template().Please take a look at
vud_widget_proxy()function definition to see the relevant code.I'm planning to make this on a hook, but if someone have other alternatives it would be great to hear about it.
Comment #2
marvil07 commentedI'm preparing a major patch for theming, so I'll going to update on #821048: make widgets easy to theme