Form Generator Setup

if you are just starting out to use forms in Gentics CMS it is recommended to use the forms feature instead of the setup described on this page.

This guide explains all necessary steps to setup the Form Generator in the CMS.

The Form Generator requires all CMS Nodes, that should contain forms to be published into a Mesh ContentRepository and to use the New Tag Editor.

1 Form Generator Plugin

The form generator plugin configuration must contain a list of all Mesh projects, that should have the plugin enabled, and an apiKey:

plugins/fg/config.yml

projects:
  - "Project_1"
  - "Project_2"
apiKey: "this-is-a-secret-api-key"

2 Custom Proxy

Configuration of a Custom Proxy is necessary, because in a normal deployment, the Mesh instance will not be accessible directly from the users’ browsers.

Instead, requests to the form generator plugin will be directed to the custom proxy URL of the CMS, which will forward the requests to Mesh.

The configuration of the custom proxy must contain the same projects and apiKey (as FG-ACCESSTOKEN) as the form generator plugin configuration.

/Node/etc/conf.d/*.conf

$MESH_BASEURL = "http://[meshhost]:[meshport]/api/v2/";
$MESH_PROJECTS = array("Project_1", "Project_2");
$FG_ACCESSTOKEN = "this-is-a-secret-api-key";
$CUSTOM_PROXY["fg"] = array(
    "baseUrl" => $MESH_BASEURL . "{{meshProject}}/plugins/fg/",
    "methods" => array(
        "GET", "POST", "DELETE"
    ),
    "permission" => array(
        "type" => 90001,
        "id" => 1
    ),
    "headers" => array(
        "FG-ACCESSTOKEN" => $FG_ACCESSTOKEN
    ),
    "parameters" => array(
        "meshProject" => array(
            "default" => $MESH_PROJECTS[0],
            "values" => $MESH_PROJECTS
        )
    )
);

3 Custom Tool

The Form Generator Tool must be configured as Custom Tool to allow users access to the UI.

The id and key must be unique for all configured custom tools.

/Node/etc/conf.d/*.conf

$CUSTOM_TOOLS[] = array(
    "id" => 1,
    "key" => "formgenerator",
    "toolUrl" => '/tools/form-generator/?sid=${SID}',
    "iconUrl" => "list_alt",
    "name" => array(
        "de" => "Formulargenerator",
        "en" => "Form Generator"
    ),
    "newtab" => false
);

4 Download URLs

To correctly generate download URLs in form data exports, the external CMS URL must be configured by setting CN_EXTERNAL_SERVER accordingly.

/Node/etc/conf.d/*.conf

$CN_EXTERNAL_SERVER = 'https://cms.domain.com';

5 Tagtype

The tagtype used to include a form into a page must include a part of type “Form”, which will let the editor select a form. The part will store and render the UUID of the selected form, which can be used to render the necessary markup for rendering the form in the implementation.

It is best practice to restrict the tagtype to the nodes, which can have forms (which should be exactly the nodes for which the respective Mesh project names are configured in the form generator plugin and the custom proxy).

6 CMS Nodes

All Nodes, which can have forms must have the feature New Tag Editor activated, because selecting forms with the Form PartType will not work with the old Tagfill dialog.