模块方法 postProcess() 不会重定向到管理页面

问题描述

当我从页面单击 helperForm 的保存按钮时,postProcess 被很好地触发,但用户没有返回到我的模块管理页面,而是停留在编辑页面

public function postProcess()
{
    if (Tools::isSubmit('submitTest')) {
        //Entries here works well when the helperform is send

        return; //The admin user stays on edit page instead of going back to my module config page
    }

    return false;
}

public function getContent()
{
    if(Tools::isSubmit('updatemyModule') || Tools::isSubmit('submitTest')) {
        return $this->postProcess().$this->renderForm();
    }
    else {
        return $this->listform();
    }
}

解决方法

由于令牌由主类检查,我只是在 postProcess 函数的末尾调用了 listform 方法

public function postProcess()
{
if (Tools::isSubmit('submitTest')) {
    //Entries here works well when the helperform is send

    return $this->listform(); //reset the context states so it goes back to mymodule config page
}

return false;
}