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

merlinofchaos’s picture

Status: Active » Fixed

I 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.