Zum Inhalt springen

Ext:form - Set the storage location of the forms

As of TYPO3 8 LTS

TYPO3 8 LTS also introduced a completely revised form extension. This now makes it very easy to create more complex forms in the backend.

The configurations of these forms are saved in a separate configuration file in YAML format for each form. This means that these files can be easily copied and reused in other TYPO3 projects. It is now also possible to use versioning systems such as Git for the form definitions.

By default, the form definitions are saved in the fileadmin/user_upload/ folder.

However, this can be changed quite easily, e.g. by using a separate directory below fileadmin/ or in a separate extension.

The storage locations are defined via the allowedFileMounts parameter in the EXT:form/Configuration/Yaml/BaseSetup.yaml file. The relevant part of this file looks like this:

TYPO3:
  CMS:
    Form:
      persistenceManager:
        allowedFileMounts:
          10: 1:/user_upload/
          ...
          ...

The complete file can be viewed in the Git repository.

In line 6, storage location no. 1 (= fileadmin) and the directory user_upload/ in it are defined as object 10.

It is now relatively easy to add other directories.

To do this, create a file in any location, for example, this could be
myFormSetup.yaml

You can create this file below fileadmin/ or within an extension directory if you are using your own template extension, for example.

However, only write the necessary lines that you want to overwrite from BaseSetup.yaml in this file.

If you want to use a folder below fileadmin/ (example):

TYPO3:
  CMS:
    Form:
      persistenceManager:
        allowedFileMounts:
          20: 1:/myForms/

If you want to use a folder within your extension:

TYPO3:
  CMS:
    Form:
      persistenceManager:
        allowedExtensionPaths:
          10: EXT:myExtension/Resources/Private/myForms/
        allowSaveToExtensionPaths: true
        allowDeleteFromExtensionPaths: true

When creating a new form, you can then select where the configuration for this form should be saved.

If you want to remove the standard definition user_upload/, use 10 instead of 20 in myFormSetup.yaml.

The folder (myForms/ in the example) must of course exist!

If you are using an extension, you can use the parameters allowSaveToExtensionPaths and allowDeleteFromExtensionPaths to allow (true) backend users to edit or delete the forms within an extension. By default, the parameters are set to false.

The new file must now be made known to the form extension.

To do this, write the following lines in the TypoScript setup:

plugin.tx_form.settings.yamlConfigurations.100 = path/to/myFormSetup.yaml
module.tx_form.settings.yamlConfigurations.100 = path/to/myFormSetup.yaml

## Of course, the path to an extension could also be specified here:
## plugin.tx_form.settings.yamlConfigurations.100 = EXT:myExtension/Resources/Private/myForms/myFormSetup.yaml
## module.tx_form.settings.yamlConfigurations.100 = EXT:myExtension/Resources/Private/myForms/myFormSetup.yaml

If you now create a new form using the form backend module, you can select the storage location (form storage) in the first step.

This page contains automatically translated content.

Updated: 09.04.2025