Feature: #108653 - Database storage for form extension
See forge#108653
Description
The
typo3/cms-form
extension has been extended to include a new database
storage adapter (
Database),
allowing form definitions to be stored in the database table
form_
instead of relying on file system storage only.
Form definitions can now be stored in three ways:
- Database storage (new, recommended) – stored as records in the
form_tabledefinition - File mounts (FAL) – stored as
.form.files in FAL storage (deprecated, see Deprecation: #108653 - Form file-based storage deprecated)yaml - Extension paths – shipped with extensions (read-only or configurable)
Storage adapter architecture
The storage layer uses the Chain of Responsibility pattern. Each storage
adapter implements the
Storage and declares
which persistence identifiers it can handle via its
supports method.
The
Storage iterates
through all registered adapters sorted by priority and delegates to the first
matching adapter.
Three adapters are shipped:
Database(priority 100)Storage Adapter Extension(priority 75)Storage Adapter File(priority 50, deprecated)Mount Storage Adapter
Database table
form_definition
A new TCA-managed table
form_ stores the form definitions
with the following fields:
label– the human-readable form nameidentifier– the unique form identifier (e.g.,contact-)form configuration– the full form definition as JSON
Records are read-only in the standard TCA editing interface. All write and
delete operations go through
Data, ensuring proper
permission checks, history tracking, and hook execution.
Form Manager wizard
A new Storage wizard step lets editors choose the storage type (file mount, extension, database) when creating or duplicating forms. When only one storage adapter is accessible, the step auto-advances.
The Form Manager now also shows a record history action in the dropdown menu for database-stored forms, linking to the TYPO3 record history module.
Record list integration
Two event listeners customize the record list of
form_
records:
- The standard edit action is replaced with a link to the Form Editor module.
- The standard delete action is removed. Deletion is only possible through the Form Manager.
- Clicking the record title opens the Form Editor instead of the TCA editing form.
Creation of
form_ records via the "New Record" wizard
is denied via page TSconfig:
mod.web_list.deniedNewTables := addToList(form_definition)
CLI command: transfer between storages
A new CLI command
form: allows form
definitions to be transferred between any two storage backends. This is particularly useful for
migrating file-based forms to database storage via the command line.
# Transfer all forms from file mounts to database
bin/typo3 form:definition:transfer --source=filemount --target=database
# Transfer a specific form by its identifier
bin/typo3 form:definition:transfer --source=extension --target=database --form-identifier=contact
# Move forms (transfer + delete from source)
bin/typo3 form:definition:transfer --source=filemount --target=database --move
# Dry-run: preview what would be transferred without making changes
bin/typo3 form:definition:transfer --source=filemount --target=database --dry-run
# Transfer to a specific target location (PID for database storage)
bin/typo3 form:definition:transfer --source=filemount --target=database --target-location=0
Available options:
--– source storage type (source database,extension,filemount)--– target storage typetarget --– target storage locationtarget- location --– transfer only a specific formform- identifier --– delete the source form after successful transfermove --– preview without making changesdry- run
Configuration
Backend users must have table access rights for the
form_
table.
Important
Permission model differences between file-based and database storage
The file-based storage allows granular access control through TYPO3 file mounts. Different backend user groups can be restricted to different storage folders effectively isolating which forms each group can see and edit.
Database storage currently relies on TCA table permissions
(
tables_ /
tables_ for
form_).
This means that all backend users who have table access can see
all database-stored form definitions — there is no
equivalent to the file mount–based isolation yet.
A dedicated access control mechanism (comparable to file mount isolation) for database-stored forms is planned but not yet implemented.
If your installation depends on separate permission boundaries for different editor groups, it is recommended to not migrate to database storage at this time and continue using file-based storage until the permission feature is available.
Impact
Editors can store new form definitions in the database by selecting the "Database" storage type in the Form Manager creation wizard.
File-based storage (file mounts) will remain functional during the deprecation
period but will trigger
E_ errors. See
Deprecation: #108653 - Form file-based storage deprecated for migration instructions. Existing
file-based forms are not affected by this change.
Extension-based storage will continue to work without change.