Add additional project

mosparo enables you to define multiple independent projects, each with its own settings, rules, and style that can be used across multiple websites or forms. Before these projects can be selected by editors in TYPO3, they need to be configured.

Add projects to site set settings (TYPO3 v13 and above)

To configure custom projects in the site settings, perform the following steps.

  1. Create an additional site set in your provider extension.

    EXT:site_package/Configuration/Sets/ExtendMospraoForm/config.yaml
    name: exapmle/extendMosparo
    label: Extend mosparo project list
    Copied!
  2. Now add a settings.definitions.yaml file to define additional projects in the Site settings editor.

    EXT:site_package/Configuration/Sets/ExtendMospraoForm/settings.definitions.yaml
    categories:
        mosparoForm:
            label: 'Form mosparo'
        mosparoForm.projects:
            label: 'Projects'
            parent: mosparoForm
        mosparoForm.projects.EXAMPLE:
            label: 'EXAMPLE'
            parent: mosparoForm.projects
    
        settings:
            plugin.tx_mosparoform.settings.projects.EXAMPLE.publicServer:
                type: string
                default: ''
                category: mosparoForm.projects.EXAMPLE
                label: 'Public server'
                description: 'Host of your mosparo installation, which is used in the frontend'
            plugin.tx_mosparoform.settings.projects.EXAMPLE.verifyServer:
                type: string
                default: ''
                category: mosparoForm.projects.EXAMPLE
                label: 'Verify Server'
                description: 'Host of your mosparo installation, which is used at the backend verification'
            plugin.tx_mosparoform.settings.projects.EXAMPLE.uuid:
                type: string
                default: ''
                category: mosparoForm.projects.EXAMPLE
                label: 'UUID'
                description: 'Unique identification number of the project in mosparo'
            plugin.tx_mosparoform.settings.projects.EXAMPLE.publicKey:
                type: string
                default: ''
                category: mosparoForm.projects.EXAMPLE
                label: 'Public key'
                description: 'Public key of the project in mosparo'
            plugin.tx_mosparoform.settings.projects.EXAMPLE.privateKey:
                type: string
                default: ''
                category: mosparoForm.projects.EXAMPLE
                label: 'Private key'
                description: 'Private key of the project in mosparo'
    Copied!
  3. Now add the new set as “dependencies” to your base site set. The same way as for Include static TypoScript via site set (TYPO3 v13 and above).
  4. Clear the TYPO3 cache through the 'Maintenance' module Admin Tools > Maintenance > Flush TYPO3 and PHP Cache > Flush cache to apply the changes.
  5. Go to Site Management > Settings in the TYPO3 backend, choose a site and enter the values for the newly created project configuration fields.
  6. The additional project is now set up and can be referenced by its name using the "selectedProject"-option.

Add projects via TypoScript

To add an additional project, you only need to include the following in your setup.typoscript file:

EXT:site_package/Configuration/TypoScript/setup.typoscript
plugin.tx_mosparoform.settings.projects.EXAMPLE {
    publicServer=
    verifyServer=
    uuid=
    publicKey=
    privateKey=
}
Copied!

Add projects to TypoScript Constants Editor

You can also configure it to appear in the backend Submodule "Constant Editor". To do so, add the following configuration to your constants.typoscript file:

EXT:site_package/Configuration/TypoScript/constants.typoscript
# customsubcategory=02_EXAMPLE=EXAMPLE project settings

plugin.tx_mosparoform.settings.projects.EXAMPLE {
    # cat=Form mosparo/02_EXAMPLE/EXAMPLE/10; type=string; label=Host of your mosparo installation, which is used in the frontend
    publicServer=
    # cat=Form mosparo/02_EXAMPLE/EXAMPLE/20; type=string; label=Host of your mosparo installation, which is used at the backend verification
    verifyServer=
    # cat=Form mosparo/02_EXAMPLE/EXAMPLE/30; type=string; label=Unique identification number of the project in mosparo
    uuid=
    # cat=Form mosparo/02_EXAMPLE/EXAMPLE/40; type=string; label=Public key of the project in mosparo
    publicKey=
    # cat=Form mosparo/02_EXAMPLE/EXAMPLE/50; type=string; label=Private key of the project in mosparo
    privateKey=
}
Copied!

and then in the setup.typoscript, we need to set the following:

EXT:site_package/Configuration/TypoScript/setup.typoscript
plugin.tx_mosparoform.settings.projects.EXAMPLE {
    publicServer={$plugin.tx_mosparoform.settings.projects.EXAMPLE.publicServer}
    verifyServer={$plugin.tx_mosparoform.settings.projects.EXAMPLE.verifyServer}
    uuid={$plugin.tx_mosparoform.settings.projects.EXAMPLE.uuid}
    publicKey={$plugin.tx_mosparoform.settings.projects.EXAMPLE.publicKey}
    privateKey={$plugin.tx_mosparoform.settings.projects.EXAMPLE.privateKey}
}
Copied!

Add projects to the mosparo element in the Form Framework editor

Editors can select from a list of projects in the mosparo form element's select box. To expand this list, do the following:

  1. Create a new Form Framework configuration file in your provider extension at Configuration/Yaml/ExtendMosparoCaptchaFormField.yaml.

    EXT:site_package/Configuration/Yaml/ExtendMosparoCaptchaFormField.yaml
    prototypes:
      standard:
        formElementsDefinition:
          MosparoCaptcha:
            formEditor:
              editors:
                300:
                  selectOptions:
                    20:
                      value: 'EXAMPLE'
                      label: 'EXAMPLE'
                    30:
                      value: 'EXAMPLE_2'
                      label: 'EXAMPLE_2'
                    ...
    Copied!
  2. Register your Form Framework configuration by adding the following to your ext_localconf.php file in your provider extension:

    EXT:site_package/ext_localconf.php
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(
        trim(
            '
                module.tx_form {
                    settings {
                        yamlConfigurations {
                            1916293528 = EXT:EXAMPLE/Configuration/Yaml/ExtendMosparoCaptchaFormField.yaml
                        }
                    }
                }
            '
        )
    );
    Copied!
  3. Clear the TYPO3 cache through the 'Maintenance' module Admin Tools > Maintenance > Flush TYPO3 and PHP Cache > Flush cache to apply the changes.