1

I'm recently working on a view and i want to show the filters (two of them) as a menu. This means: That both filters can't be used at the same time (most important, a.k.a if one filter is already used and we click on the second, the first one is initiated), That the list of elements of each filter is shown when the mouse is on (less important) That the -All- should be replaced by the name of the filter (least important)

I have tried to look for it in the internet and find some answers that didn't work for me (here is the solution for an oldest version of drupal https://www.drupal.org/node/1111712)

Thank you ^^ Edit : I've developed a function to choose between both filters, but it's still not working

$testpriorite=0;
if((isset($form_state['input']['term_node_tid_depth_1']))&&(isset($form_state['input']['term_node_tid_depth']))){
    if(($form_state['input']['term_node_tid_depth_1']!="All")
      &&($form_state['input']['term_node_tid_depth']!="All")){
        if($testpriorite==1){
            $form_state['input']['term_node_tid_depth_1']="All";
        }elseif($testpriorite==2){
            $form_state['input']['term_node_tid_depth']="All";
        }
        $testpriorite=0;
    }elseif ($form_state['input']['term_node_tid_depth_1']!="All"){
        $testpriorite=1;
    }elseif ($form_state['input']['term_node_tid_depth']!="All"){
        $testpriorite=2;
    }

here term_node_tid_depth and term_node_tid_depth_1 are my two filters. Does someone have an idea ?

thanks again

1

Instead of calling directly the view you call a rules link.

The rules link is calling the view with the desisered parameters for the view. In this case the filter can be used as a contextuel filter.

No programming needed.

| improve this answer | |
  • I'll try that and keep you updated. Thank you for the answer ^^ – Ismail H Apr 16 '15 at 14:09
0

I did manage to find a solution to my problem. For that i create a menu (that looked like the filters), and for each link i entered /(ViewUri)?=. I unactivated ajax and deleted the "$exposed" part in the .tpl.php template file of the view.

If anyone needs more explanation, i'm still here (for now, winter's coming)

Sorry for bothering you all, and thanks again.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.