I have a view with a url of "myview/filter" and I am trying to pass a dynamic argument for the view to use to filter the nodes by Node Title - and I can't figure out why it's not working.

So, for example a sample url would be "myview/filter/november" where 'november' would be the argument. And I would like it to return all nodes that contain 'november' in the node title.

My argument handling code:


$view->filter[3]['vid'] = '16';
$view->filter[3]['tablename'] = '';
$view->filter[3]['field'] = 'node.title';
$view->filter[3]['value'] = $args[0];
$view->filter[3]['operator'] = 'allwords';
$view->filter[3]['options'] = '';
$view->filter[3]['position'] = '3';
$view->filter[3]['id'] = 'node.title';
$view->is_cacheable = 0;
return $args;

Any ideas why this doesn't work? Thanks.

Comments

apersaud’s picture

Also - if I manually add a 'value', it works fine - like this:

$view->filter[3]['vid'] = '16';
$view->filter[3]['tablename'] = '';
$view->filter[3]['field'] = 'node.title';
$view->filter[3]['value'] = 'november';
$view->filter[3]['operator'] = 'allwords';
$view->filter[3]['options'] = '';
$view->filter[3]['position'] = '3';
$view->filter[3]['id'] = 'node.title';
$view->is_cacheable = 0;
return $args;

It just doesn't accept the argument.

jbfp’s picture

Did you ever figure this out?