lukeyouell/craft-contactformtemplates

此包已被废弃,不再维护。未建议替代包。

为Craft CMS联系表单插件定制的电子邮件模板

1.0.1 2018-04-11 13:41 UTC

This package is not auto-updated.

Last update: 2019-11-16 17:15:28 UTC


README

icon

Craft CMS 3的联系人表单模板插件

为Craft CMS联系表单插件定制的电子邮件模板

要求

此插件需要Craft CMS 3.0.1或更高版本和Contact Form 2.1.1或更高版本。

安装

要安装插件,可以通过插件商店安装或按照以下说明操作。

  1. 打开您的终端并转到您的Craft项目

     cd /path/to/project
    
  2. 然后让Composer加载插件

     composer require lukeyouell/craft-contactformtemplates
    
  3. 在控制面板中,转到设置 → 插件,并点击“安装”按钮以安装联系人表单模板。

使用联系人表单模板

要使用自定义电子邮件模板,只需将以下字段添加到您的表单中

<input type="hidden" name="message[template]" value="{{ 'path/to/template'|hash }}">

message[template]值用于检索位于templates/_emails中的模板文件,此值必须进行散列以防止篡改。

示例

<input type="hidden" name="message[template]" value="{{ 'foo/bar'|hash }}">

将查找以下模板

templates/_emails/foo/bar.twig

模板变量

提交的字段值可以通过使用{{ submission }}在模板中使用。

示例

<input type="text" name="fromName" value="Joe Bloggs">

将使用以下方式在模板中使用

{{ submission.fromName ?? 'Fallback Value' }}

这将输出

Joe Bloggs or Fallback Value

联系人表单模板路线图

一些要完成的事项和潜在功能的想法

Luke Youell提供