开发者

Views pre execute

I 开发者_运维问答want to alter some arguments from texonomy_term view.

function MYMODULE_views_pre_execute(&$view){
    if ($view->name == 'taxonomy_term') {

        $view->set_arguments(array(1)); // I want to change first arg to '1'

    }
}

But nothing works. On term page the result remains the same (default).


I found the answer. I had to use hook_views_pre_view()


You don't need module code for that; you can specify in the Views UI that the first argument should default to 1 (or any other value).


You can also set the default argument to '1' on the views argument section .

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜