I
I
insci2016-03-11 21:20:24
Yii
insci, 2016-03-11 21:20:24

Yii2 how to pass argument to filter?

Is it possible to pass an argument to a filter, and if so, how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2016-03-11
@insci

Can you be more specific? What kind of filter do you mean? In general, parameters are passed to filters as follows:

public function behaviors()
{
    return [
        'customFilter' => [
            'class' => \some\custom\FilterClassName,
            'param1' => $value1,
            'param2' => $value2,
            ...
        ]
    ]
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question