从钩子呈现时,prestashop 1.7.6 中缺少 $template 参数

Missing $template parameter in prestashop 1.7.6, when rendered from hook

我正在使用 Prestashop 1.7.6.4。我想在钩子中呈现一个模板。我正在通过以下代码执行此操作:

class MyModuleName extends PaymentModule
{

    public function hookActionValidateOrder($params)
    {
        /**
         * Verify if this module is enabled
         */
        if (!$this->active) {
            return;
        }

        if (Configuration::get('inline')) {
            $this->context->smarty->assign([
                'module' => $order->module
            ]);

            return $this->display(__FILE__,
                'views/templates/hook/displayStatusOrder.tpl');

        }
        // more code goes here
    }

}

请注意,我也尝试过

return $this->fetch('module:myModule/views/templates/hook/displayStatusOrder.tpl');

结果相同

但是我收到以下错误:

(1/1) SmartyException
0():Missing '$template' parameter

我绝对确定我的模板存在。它有正确的名称。

我的文件夹结构是这样的:

myModuleName
  views
    templates
      hook
        displayStatusOrder.tpl

我试过删除缓存、重装模块等等

我显然遗漏了一些明显的东西。感谢任何帮助。

hookActionValidateOrder是动作挂钩,不是显示挂钩,所以不能显示模板。

您需要在要显示代码的模板中签入哪些挂钩可用。