I have a D7 site where I have several main topics, each containing subtopics. I've made a views block which is shown on each of the pages of the main topics where you have two filter options:
- Filter on main topic
- Filter on subtopic
The idea is that when the user enters a URL like www.mysite.com/topics/maintopic, the main topic filter radio button is set automatically to the main topic the user entered and the first sub-topic for that main topic.
So how can I do that? I tried with a contextual filter, but unless I missed something I don't see an option to preselect a radio button in an exposed filter (nor in fact to filter basing on the last part of a URL, unless it's an argument). I also tried the following code.
function MYMODULE_form_views_exposed_form_alter(&$form, &$form_state) {
// ...
}
I didn't see any option to alter which radio button is selected.