Posted by surgeonbor on March 17, 2010 at 3:46pm
2 followers
Jump to:
| Project: | Vote Up/Down |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
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
#1
You 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.
#2
I'm preparing a major patch for theming, so I'll going to update on #821048: make widgets easy to theme