0
public function actionMyPluginActionControllerIndex(){
    $this->myPluginActionController($myVariable);
    return something;
}

public function actionMyPluginActionController($myVariable)
{
    return something;
}

This is giving me the error:

{"error": "Missing required parameters": myVariable"}

I did exactly this with a craft 2 plugin, but somehow this doesn's seems to work in craft 3 anymore, what am i missing?

any help will be appreciated :)

0

You receive this error because actionMyPluginActionController expects a variable in it's parameters. You'll have to declare a default value

public function actionMyPluginActionController($myVariable = null)

or you need to declare something in your actionMyPluginActionControllerIndex

public function actionMyPluginActionControllerIndex(){
    $myVariable = 'foo';
    $this->myPluginActionController($myVariable);
    return something;
}

Unless you deactivated error messages/warnings on global level (via web config, dev mode off or something else), there is no way this would work in Craft 2 by default

1
  • That did the job! Note: Unless you deactivated error messages/warnings on global level (via web config, dev mode off or something else), there is no way this would work in Craft 2 by default These cases were neither set, it was indeed the variable declaration.
    – Kevon
    Apr 24 '18 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.