Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_module_form_alter(&$form, &$form_state, $form_id) {
- if ($form_id == 'views_exposed_form') {
- // Exclude cases when query contains 'field_color_tid'.
- if (strpos($_SERVER['QUERY_STRING'],'field_color_tid') === FALSE) {
- // Act only if query string contains 'field_size_tid'
- if (strpos($_SERVER['QUERY_STRING'],'field_size_tid') !== FALSE) {
- $selected_tid = $form_state['view']->exposed_input['field_size_tid'];
- // Check if such taxonomy term exists.
- $term = taxonomy_term_load($selected_tid);
- if (!empty($term)) {
- // Redirect to taxonomy page.
- $path_alias = drupal_get_path_alias('taxonomy/term/'.$selected_tid);
- drupal_goto($path_alias);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment