Jekis
Jekis

Reputation: 4695

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).

Upvotes: 1

Views: 3947

Answers (3)

prabeen giri
prabeen giri

Reputation: 803

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

Upvotes: 0

Jekis
Jekis

Reputation: 4695

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

Upvotes: 3

marcvangend
marcvangend

Reputation: 5642

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).

Upvotes: 0

Related Questions