开发者

Drupal: change view argument

开发者 https://www.devze.com 2023-01-08 09:55 出处:网络
I searched far and wide to find a working solution to开发者_C百科 this but couldn\'t find it. What I want to do is change the argument that is passed to the view because I want for pathauto cleaned t

I searched far and wide to find a working solution to开发者_C百科 this but couldn't find it.

What I want to do is change the argument that is passed to the view because I want for pathauto cleaned taxonomy terms to work as an argument. I have a code that transforms cleaned term back to a original one, but cannot make the view use it.

I saw some people changing it in hook_preprocess_views_view(&$vars) but in my case (Views 2.11) has a argument in $vars instanced so many times that it's not the way.

Can anyone please help me change this argument?


There may be a better way but you could use views_embed_view() and set the arguments yourself


I have two ideas, either to add some custom php code to the view's argument's phpcode section that does something like this

$args[0] = 1;
return $args;

or try to use the function

hook_views_pre_view(&$view, &$display_id, &$args) {
  // modify $args value here
}

didn't test them so don't know which will work.


I think hook_views_pre_view might help you do just that.

0

精彩评论

暂无评论...
验证码 换一张
取 消