Posted by BrockBoland on December 2, 2011 at 2:32pm
1 follower
| Project: | Exposed Filter Data |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
As it works right now, get_exposed_filter_output() calls theme('exposed_filter_data'), so exposed_filter_data_preprocess_exposed_filter_data() runs. This checks if $vars['view'] is set, and if not, calls views_get_current_view() to get the current view.
This could be improved in a couple ways:
- As far as I can tell,
$vars['view']is never set, ifget_exposed_filter_output()is called. If a developer callstheme('exposed_filter_data')and passes a view object as the second argument, it will be set, but not when using the recommendedget_exposed_filter_output() - If no view object is passed when calling
theme('exposed_filter_data'), the view object will not be available inexposed_filter_data.tpl.php: the view is loaded by callingviews_get_current_view(), but it's not put back into the$varsarray. The template file included with the module doesn't try to use$view, but developers who override that template (for example, me) may want to.
I see a couple quick and easy changes that will improve the developer experience:
- Accept a view object as an argument to
get_exposed_filter_output()and pass through totheme('exposed_filter_data'). This way, when callingget_exposed_filter_output()in some preprocess function or template file, the developer can specify the view object to use. - If the view object is not passed in, save it back into the
$varsarray after callingviews_get_current_view()to retrieve it, so that it's available to the template file.
Patch forthcoming.
Comments
#1
Patch attached. The original issue report explains what it does.