Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.8
Component:
page displays
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2010 at 00:12 UTC
Updated:
26 Mar 2010 at 02:30 UTC
Hi,
Is it possible to change the title of a filtered view by the URL? So I've got a content type that I filter by designer. Once the filter has been applied it displays a view with the following link drupal/content?designer=John+Doe
Now I would like the title of that view to change according to the designer. So I need the title to say "Content filtered by 'John Doe'" and obviously the name of the designer will depend on who they filter the content by.
Thanks ahead.
Comments
Comment #1
merlinofchaos commentedI think you could accomplish this via hook_form_alter. Check for the form 'views_exposed_form' and then check $form_state['view'] to make sure it is the right view.
Then in theory you can use $form_state['view']->display_handler->set_option('title', "my new title") based upon what you see in $_GET. Note that the view will not have run yet, so you won't get filtered values, and if you do use $_GET be sure to run it through check_plain() first to ensure that there are not XSS security holes in your code.