I have a view that I want to change two items right before the page loads - the title, and the zipcode that determins the location to filter by.
My module detects a person's location and replaces the default value in the Views filter so that the results are properly sorted by that area.
So, the title changes to 'Viewing items around Charlotte, NC' where Charlotte, NC is the dynamic element.
I have created a module, but I am not sure what views hooks I need to use to achieve the results, especially getting the view to execute with the new location.
Here are the views hooks for D7 http://api.drupal.org/api/views/views.api.php/group/views_hooks/7
Do I pre_view it? pre_render? Alter the query with the new location details before its executed?
Here is a sample of my module trying to use hook_views_pre_view
function zipcode_filter_views_pre_view ( &$view, &$display_id, &$args) {
$view = views_get_view('baby_clothes_pages');
$view->set_display('default');
$view->set_exposed_input(array('postal_code' => $zipcode));
$view->display['default']->handler->options['title'] = $title;
}
note: this reference influeced the code I used. However, the documentation is wanting. Am I even on the right track with this? http://groups.drupal.org/node/10129