pagemachine / typo3-formlog
TYPO3表单日志
Requires
- php: ^8.0
- league/csv: ^9.1
- nimmneun/onesheet: ^1.0
- typo3/cms-backend: ^11.5 || ^12.4
- typo3/cms-core: ^11.5 || ^12.4
- typo3/cms-extbase: ^11.5 || ^12.4
- typo3/cms-fluid: ^11.5 || ^12.4
- typo3/cms-form: ^11.5 || ^12.4
- typo3/cms-frontend: ^11.5 || ^12.4
- typo3fluid/fluid: ^2.3
Requires (Dev)
- cakephp/cakephp-codesniffer: ^5.0
- ergebnis/composer-normalize: ^2.3
- helmich/typo3-typoscript-lint: ^3.0
- jangregor/phpstan-prophecy: ^1.0.0
- michielroos/typo3scan: ^1.7
- php-parallel-lint/php-console-highlighter: ^1.0.0
- php-parallel-lint/php-parallel-lint: ^1.2
- phpspec/prophecy-phpunit: ^2.0
- phpstan/phpstan: ^1.0.0
- phpunit/phpunit: ^9.0
- rector/rector: ^0.18.5
- saschaegerer/phpstan-typo3: ^1.0.0
- sclable/xml-lint: ^0.6.0
- slevomat/coding-standard: ^8.0
- squizlabs/php_codesniffer: ^3.1
- typo3/cms-scheduler: ^11.5 || ^12.4
- typo3/testing-framework: ^7.0 || ^8.0
Suggests
- typo3/cms-scheduler: Allows automatic deletion of old form log entries.
Replaces
- typo3-ter/formlog: 2.2.3
- dev-master
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.4.1
- 1.4.0
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- dev-renovate/typo3-coding-standards-0.x
- dev-renovate/typo3fluid-fluid-4.x
- dev-renovate/phpunit-phpunit-11.x
- dev-drop-bower
- dev-dynamic-filters
This package is auto-updated.
Last update: 2024-09-11 09:58:07 UTC
README
TYPO3表单日志
安装
此扩展可以从各种来源安装
-
通过Composer
composer require pagemachine/typo3-formlog
用途
TYO3 表单扩展中缺少一个功能是表单数据的日志记录。如果您曾经使用过现在已停用的Formhandler扩展,您就知道这有多有价值。您可以通过导出到CSV或类似格式来轻松检查表单提交是否按预期工作,查看内部值是否正确生成,并进行一些基本分析。
请参阅我们的关于TYPO3表单日志扩展的博客文章。
开始记录
可以通过向其表单定义中添加LogFormData
完成器来为任何表单启用日志记录
finishers:
- ...
- identifier: LogFormData
- identifier: Redirect
LogFormData
完成器应该是最后一个完成器,或者在使用Redirect
完成器之前。重定向之后无法进行日志记录。
还可以通过使用finisherVariables
选项记录存储在FinisherVariableProvider
中的附加变量
- identifier: LogFormData
options:
finisherVariables:
MyCustomFinisher:
- myCustomVariable
finisherVariables
中的键是在表单中使用的完成器的标识符,每个条目的值是完成器变量名称的列表。在此示例中,由完成器MyCustomFinisher
提供的完成器变量myCustomVariable
将被记录。
表单日志模块
默认情况下,表单日志模块显示一些基本字段,如页面、表单标识符、语言和表单提交日期作为列。
可以通过在ext_typoscript_setup.txt
中设置list.columns
来添加额外的列
module.tx_formlog {
settings {
list {
columns {
100 {
property = data.email
label = LLL:EXT:my_site/Resources/Private/Language/Extensions/Form/locallang.xlf:element.email.properties.label
}
}
}
}
}
在list.columns
中可以添加任意列,其中property
选项引用FormLogEntry
域模型中的属性路径。简单地说,data.*
通过表单元素标识符提供对表单数据的访问,例如data.email
用于email
表单元素的值。使用label
选项检索可翻译的标签。通常,可以简单地使用在表单本身中使用的相同标签。
同样,finisherVariables.*
通过利用完成器标识符和变量名称为额外的完成器变量执行相同的操作
module.tx_formlog {
settings {
list {
columns {
200 {
property = finisherVariables.MyCustomFinisher.myCustomVariable
label = LLL:EXT:my_site/Resources/Private/Language/Extensions/Formlog/locallang.xlf:formlog.entry.finisherVariables.MyCustomFinisher.myCustomVariable
}
}
}
}
}
在这里,将MyCustomFinisher
的myCustomVariable
添加为列表的列。
表单日志导出
默认情况下,表单日志条目可以导出到CSV和Excel(XLSX)。默认导出表单日志条目的基本字段,可以通过在ext_typoscript_setup.txt
中的export.columns
设置添加额外的列,该设置与list.columns
设置配置相同
module.tx_formlog {
settings {
export {
columns {
100 {
property = data.firstname
label = LLL:EXT:my_site/Resources/Private/Language/Extensions/Form/locallang.xlf:element.firstname.properties.label
}
101 {
property = data.lastname
label = LLL:EXT:my_site/Resources/Private/Language/Extensions/Form/locallang.xlf:element.lastname.properties.label
}
102 {
property = data.email
label = LLL:EXT:my_site/Resources/Private/Language/Extensions/Form/locallang.xlf:element.email.properties.label
}
200 {
property = finisherVariables.MyCustomFinisher.myCustomVariable
label = LLL:EXT:my_site/Resources/Private/Language/Extensions/Formlog/locallang.xlf:formlog.entry.finisherVariables.MyCustomFinisher.myCustomVariable
}
}
}
}
}
日志条目清理
可以将表垃圾收集调度任务设置为自动删除旧表单日志条目。选择tx_formlog_entries
作为要清理的表,以及删除给定天数之前的老条目的合适值,默认为180天。
测试
所有测试都可以使用随附的Docker Compose定义执行。
docker compose run --rm app composer build
谢谢
本包的开发自豪地得到了TÜV Hessen的支持。