TWIG 表格中的新行(Prestashop HelpBox)

New Line in TWIG Form (Prestashop HelpBox)

我在修改 Prestashop Forms 时遇到了一个小问题,它适用于从 v.17 向上的 Symfony TWIG 表单。

我想在帮助框中添加一个新行,这是我用来尝试创建新行的代码。

<span class="help-box" data-toggle="popover"
    data-content="                              
    {{ "Please key-in either one of %, $ or # for the discount type of the 
        reward:
    <br />
    % - Discount in Percentage
    $ - Discount in USD"|trans({}, 'Admin.Catalog.Help')
    }}" >
</span>

相反,我得到了这个结果:

如此处所示,格式将被视为普通文本,而不是特殊格式 NewLine Character

有没有办法把所有的字符串都变成raw,从而实现换行?

感谢您的宝贵时间。

在弹出窗口中必须指明您将使用 HTML 代码和 data-html="true",此代码应该有效:

<span class="help-box" data-toggle="popover" data-html="true"
    data-content="                              
    {{ "Please key-in either one of %, $ or # for the discount type of the 
        reward:
    <br />
    % - Discount in Percentage
    $ - Discount in USD"|trans({}, 'Admin.Catalog.Help')
    }}" >
</span>

You can see more info about popover in the official documentation of Bootstrap 4.