Drupal filter is not working properly

265 views Asked by At

I'm not sure how to ask it, so if you need anymore additional information, please ask for it!

Situation
I've got a website in three languages. I got a lot of customer cases online each connected to a sector (depending in which sector they belong). Each sector and reference has it's own unique nid.

In my template.php it's stated like this:

if ('sector' == $vars['node']->type) {
        $lang = '/'.$vars['language'].'/';

        $key_path = $_SERVER['REQUEST_URI'];
        $key_path = substr_count($key_path, $lang) ? substr($key_path, strlen($lang)) : $key_path;
        if (strpos($key_path, '?')) $key_path = substr_replace($key_path, '', strpos($key_path, '?'));

        if (strpos($key_path, 'sectors-references') === 0) {        
            $view = views_get_view('references');
            if (!empty($view)) {
                $view->set_arguments((int)$vars['node']->nid);  
                $vars['content']['suffix'] = $view->render();

            }
        }
    }

And yet, every sector shows me the same references... What do I have to change to get the correct reference under the right sector?

1

There are 1 answers

2
Clive On BEST ANSWER

Usually arguments are passed to set_arguments using an array, if you pass a non-array the argument will probably be ignored which is why you're always getting the same result. Try:

$view->set_arguments(array((int)$vars['node']->nid));