oliverthiele/ot-formprefill
Composer 安装命令:
composer require oliverthiele/ot-formprefill
包简介
TYPO3 extension that automatically fills in form fields for logged-in frontend users using values from fe_users. Includes optional FlexForm-based field mapping and works with existing forms.
README 文档
README
Form Prefill for TYPO3 Frontend Users – A TYPO3 v13 extension that automatically fills in form fields for logged‑in frontend users (fe_users).
Works out‑of‑the‑box with the native Form Framework (EXT:form) and any form that follows the tx_form_formframework[<formIdentifier>][<field>] naming scheme.
Field mapping is fully configurable via FlexForm or config.yaml – no TypoScript required.
Features
- Prefills input and textarea fields on the client side via JavaScript.
- Secure PSR‑15 middleware that exposes only whitelisted
fe_usersfields as JSON (/prefill-user.json). - Flexible one‑to‑one mapping between
fe_userscolumns and form field keys - Generic or UID-specific mapping definitions via
config.yaml. UID-specific mapping can also be defined per content element (via FlexForm). - Multiple forms per page supported.
- Implemented as a dedicated
CType(formprefill) – ready for TYPO3 v14 (nolist_type). - Zero database changes and no modifications to existing forms.
Requirements
| TYPO3 | 13.4 LTS (13.4.14 +) |
| PHP | 8.1 + |
| Composer | 2.x |
Installation
composer require oliverthiele/ot-formprefill
- Flush caches.
Configuration
Site Configuration (config.yaml)
otFormprefill: allowedFields: - name - email - company - telephone formMappings: contactForm: name: text-1 company: text-2 email: email-1 contactForm-19022: name: text-1 company: text-3 # Overrides generic mapping telephone: text-4 # Adds extra field only for this form UID
Mappings without UID act as default (by persistenceIdentifier).
Mappings with UID (e.g. kontaktformular-19022) override or extend the generic mapping.
Extension Configuration (ext_conf_template.txt)
# cat=basic/enable; type=string; label=Allowed FE User fields
allowedFields = username,name,title,first_name,middle_name,last_name,company,address,zip,city,country,telephone,fax,email,www
Used only if no config.yaml is present. These fields are also hard-limited in the middleware.
TypoScript Setup
A full TypoScript setup is provided.
Option 1: Manual import
If you manage TypoScript manually (e.g. in your sitepackage), include it like this:
@import 'EXT:ot_formprefill/Configuration/TypoScript/setup.typoscript'
Option 2: TYPO3 v13 Set autoloading
If you're using TYPO3 v13's new "Site sets" system, you can add the dependency:
name: example/my-site-package label: 'My Site Package' dependencies: - oliverthiele/ot-formprefill
This automatically includes the setup file and assets.
Usage
1. Add the content element
Insert the Form Prefill content element (CType: formprefill) on the same page as your form.
2. Configure the FlexForm (optional)
| Field | Description |
|---|---|
| Form Identifier | Optional. Unique prefix for the form, e.g. contactForm-42. Required when multiple forms exist. |
| Mapping | One mapping per line: fe_usersField:formFieldKey, e.g.company:firma``email:email |
If no mapping is configured, automatic mapping is used: fe_users.column → same form field name.
3. Output
After rendering, the ViewHelper will inject the mapping into the page as JavaScript:
<script> window.formPrefillMappings = { "contactForm-42": { "email": "email", "fullName": "name" } } </script>
Middleware: /prefill-user.json
If a frontend user is logged in, this endpoint returns a filtered list of their fields:
{
"name": "Max Mustermann",
"email": "max@example.com"
}
The list is determined (in order):
site/config.yaml→otFormprefill.allowedFields- Extension setting (
ext_conf_template.txt) - Fallback default
Developer Notes
- JavaScript is located in
Resources/Public/JavaScript/FormPrefill.js, embedded via<f:asset.script defer="true"> - Middleware route:
Configuration/RequestMiddlewares.php - CType registration:
TCA/Overrides/tt_content.php - Icon:
Configuration/Icons.php - Mapping logic combines
persistenceIdentifierand content element UID
Roadmap
- Unit tests for the middleware.
License
GPL‑2.0‑or‑later – see LICENSE
Sponsor
Initial development was sponsored by WWE Media GmbH Agency for digital products
Author
Oliver Thiele – oliver-thiele.de Mail: mail@oliver-thiele.de
oliverthiele/ot-formprefill 适用场景与选型建议
oliverthiele/ot-formprefill 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「form」 「typo3」 「fe_users」 「prefill」 「frontend user」 「formframework」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oliverthiele/ot-formprefill 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oliverthiele/ot-formprefill 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oliverthiele/ot-formprefill 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Set Links with a specific language parameter
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
This TYPO3 extension enables frontend users to created news records.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
This TYPO3 extension enables frontend users to add ext:calendarize items in the frontend.
An interactive tour through the TYPO3 backend.
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2025-06-23