georgringer / news-form-fill
为 EXT:form 的完成者提供文章记录
dev-main
2024-05-01 05:44 UTC
Requires
- php: >= 8.2 < 8.4
- georgringer/news: ^10 || ^11 || ^12
- typo3/cms-form: ^12.4.2
This package is auto-updated.
Last update: 2024-08-31 00:38:53 UTC
README
本扩展将新闻记录(EXT:news)的信息提供给由 EXT:form 生成的电子邮件。
典型用例:想象基于新闻文章的活动。每篇文章都包含一个链接到注册表单的页面。
安装
使用 composer req georgringer/news-form-fill
安装扩展。
用法
表单配置
新可用的完成者需要放在电子邮件完成者之前。
可以使用以下界面,或者手动在 yaml 文件中添加完成者
finishers: - identifier: NewsVariableProvider
之后,在表单中放置一个标识为 newsid
的隐藏字段
- defaultValue: null type: Hidden identifier: newsid label: News
表单链接
使用如下链接生成表单
https://example.ddev.site/booking?newsid=123
现在您可以通过检查您页面的源代码来检查预填充是否正常工作。它应该包含一个包含新闻 id 的隐藏字段。
<input id="form-identifier-newsid" type="hidden" name="tx_form_formframework[form-identifier][newsid]" value="1" />
在模板中使用新闻信息
此扩展在 BaseSetup.yaml
文件中注册了一个示例布局
TYPO3: CMS: Form: prototypes: standard: finishersDefinition: EmailToReceiver: options: templateRootPaths: 1714495718: 'EXT:news_form_fill/Resources/Private/Templates/Finishers/Email/' EmailToSender: options: templateRootPaths: 1714495718: 'EXT:news_form_fill/Resources/Private/Templates/Finishers/Email/'
查看 Resources/Private/Templates/Finishers/Email/Default.html
以了解如何在电子邮件中检索新闻信息。
目前对以下字段有硬编码的访问:uid、pid、标题、摘要、正文。
感谢
- Manuel Schnabel 因其 扩展 而感谢,我从中学到了很多,并且也使用了部分代码!
- Gernot Hofer 为赞助此扩展的开发而感谢