I have a typical / classical ACF declaration, in my app-basic application, that uses matchCallback:
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
echo 'Yii::$app->controller->actionParams = '.print_r(Yii::$app->controller->actionParams, TRUE);
echo '$action->controller->actionParams = '.print_r($action->controller->actionParams, TRUE);
echo '$action = '.print_r($action, TRUE);
die();
}
],
],
]
];
}
To my surprise, I found this:
How can this be true? Why action parameters are not available when evaluating matchCallback?
And – of course – how to read them, if my access rule requires to check one of action parameters to judge, whether user can access particular action or not?
EDIT: You can, of course, read action parameters using the brutal way of:
echo '$_GET = '.print_r($_GET, TRUE);
But, I don’t like brutal solutions and it really bothers me, why actionParams are empty at this stage?