0

I have a taxonomy page where different view panes of a single view are displayed. I want to pass contextual filter to only kind of View pane. I wrote this code but this passes the contextual filter to all the view panes on the page. How can I pass contextual filter to a single specific view pane? Thank you for your time.

function intrakicalendarrss_views_pre_view(&$view, &$display_id, &$args) { $arg0 = arg(0); $arg1 = arg(1); $arg2 = arg(2); if($view->name = 'current_event_list') { if($arg0 == 'taxonomy' && $arg1 == 'term' && ($arg2 == 1 || $arg2 == 2)) { $Cfilter = $arg2; $args[0] = $Cfilter; } } }

1

Add another condition to check the specific display name

if($view->current_display == 'display_name')

Here display_name of particular display can be found in Advanced Option -> Machine Name

1

Try using $view->current_display like this:

function intrakicalendarrss_views_pre_view(&$view, &$display_id, &$args) {
  $arg0 = arg(0);
  $arg1 = arg(1);
  $arg2 = arg(2);
  if ($view->name == 'current_event_list' && $view->current_display == 'your_display') {
    if ($arg0 == 'taxonomy' && $arg1 == 'term' && ($arg2 == 1 || $arg2 == 2)) {
      $Cfilter = $arg2;
      $args[0] = $Cfilter;
    }
  }
}

You are also using a single equals sign in your if statement instead of a double or triple equals, which means that if statement will always return true.

  • Thank you rooby for your time, Pravin answered it first, so I accepted that. – rashidkhan Nov 27 '14 at 12:54

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.