EXT:form 在 7.5 中被完全重写。整个前端渲染被extbase和fluid取代。
不幸的是,尚未记录所有更改。几周前,我对可在此处找到的文档进行了重大清理:https ://docs.typo3.org/typo3cms/extensions/form/ 。布局部分对您来说更有趣。链接的文档将解释如何设置视图特定布局。
但是当涉及到 TYPO3 7.6 中的布局自定义时,通过 TypoScript 使用 .layout 的东西不再是最好的方法了。如更新日志所示,您应该使用流体。以下示例描述了具有一些新功能的表单。我正在全局设置一个额外的部分路径。但也可以为特定的表单元素设置部分路径(参见元素“900”)。
plugin.tx_form {
view {
# set up additional partial path
partialRootPaths.20 = EXT:generic_lib/Resources/Private/Extensions/Form/Partials/
}
}
# build contact form
lib.default_contact_form = FORM
lib.default_contact_form {
prefix = {$content.mailform.prefix}
confirmation = 1
# want to work on a clean base without .layout settings
compatibilityMode = 0
postProcessor {
1 = mail
1 {
recipientEmail = {$content.mailform.recipientEmail}
senderNameField = name
senderEmailField = email
ccEmail = TEXT
ccEmail {
# depends on the fact that email is required and tested
data = GP:tx_form_form|{$content.mailform.prefix}|email
htmlSpecialChars = 1
}
subject = TEXT
subject {
value = [{$website.title}] - Kontakt
lang.en = [{$website.title}] - Contact
lang.es = [{$website.title}] - Contacto
lang.it = [{$website.title}] - Contatto
}
}
2 = redirect
2.destination = {$content.mailform.redirectPage}
}
10 = TEXTLINE
10 {
name = name
required = required
type = text
label.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:name
placeholder.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:name
}
20 = TEXTLINE
20 {
name = email
type = email
required = required
label.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:email
placeholder.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:email
}
30 = TEXTAREA
30 {
name = message
cols = 40
rows = 5
required = required
data-foo = bar
label.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:message
placeholder.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:message
}
900 = TEXTLINE
900 {
name = honeypot
type = text
label.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:spam
placeholder.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:spam
autocomplete = off
partialPath = FlatElements/Honeypot
# hide field in confirmation and mail views
visibleInConfirmationAction = 0
visibleInMail = 0
}
1000 = SUBMIT
1000 {
name = submit
value.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:submit
class = button
}
rules {
1 = required
1 {
element = name
message.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:required
error.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:mandatory
}
2 = email
2 {
element = email
message = (max.muster@domain.com)
error.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:mandatory_email
}
}
}
如果您需要任何进一步的帮助,您可以加入typo3.slack.com并打开 ext-form 频道。在那里,您会找到更多示例和即时帮助。