Simple question: I made a button in my plugin settings that creates a Craft.postActionRequest but what should the controller return?

It does not need to return anything else than true (successful) or string (action was not successful -> errormessage) but if I return a true or a false or anything else than a template to render I get an error...

Little example:
my template is just

{{ response }}

And my controller

//correct -> no error, this template is just empty
public function actionDeleteAccessToken(){
    return $this->renderTemplate('srgoogleanalytics/tools/empty', array(response => true));

but if I make something like this

public function actionDeleteAccessToken(){
    return true;

I receive a PHP error file not found. What do I wrong?

1 Answer 1


If you're just looking to return true or an error message from your controller's action, then it should probably be something like:

$this->returnJson(array('success' => true));

Or on error:


returnErrorJson will set an 'error' key and pass whatever mess you use as its value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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