Skip to content

Contact Form

contact_form module is used to display a contact form. It makes a use of contact_form macro

Configuration parameters

title

string a title of the module.

shouldDisplayDescription

int if set to 1 display module description.

description

string a description of the module.

shouldDisplayNameField

int if set to 1 a name field will be displayed in the contact form.

shouldDisplaySubjectField

int if set to 1 a subject field will be displayed in the contact form.

shouldDisplayAdditionalFields

int if set to 1 additional fields will be displayed in the contact form.

Module source code

{% from "@macros/contact_form.twig" import contact_form %}

{{
    contact_form(moduleConfig|merge({
        instanceId: moduleInstance
    }))
}}

Macros reference

Module configuration schema

[
    {
        "state": "unfolded",
        "label": "General settings",
        "elements": [
            {
                "type": "text",
                "name": "title",
                "label": "Module title",
                "supportsTranslations": 1,
                "defaultValue": "Contact form"
            },
            {
                "type": "checkbox",
                "name": "shouldDisplayDescription",
                "label": "Display additional description below the module title",
                "defaultValue": 0,
                "children": [
                    {
                        "type": "textarea",
                        "name": "description",
                        "label": "Description",
                        "isHidden": 1,
                        "supportsTranslations": 1,
                        "relations": [
                            {
                                "parentName": "shouldDisplayDescription",
                                "parentValueToActionsMap": [
                                    {
                                        "value": 0,
                                        "actions": ["setHidden", "setDisabled"]
                                    },
                                    {
                                        "value": 1,
                                        "actions": ["setVisible", "setAvailable"]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    },
    {
        "state": "unfolded",
        "label": "Form fields",
        "elements": [
            {
                "type": "infobox",
                "name": "infobox",
                "options": {
                    "type": "blank",
                    "message": "%s Related settings in the admin panel%s changing phrases in [translations](%s)%s adding and changing the activity of [additional form fields](%s)",
                    "placeholderValues": [
                        "####",
                        "\n",
                        "\/admin\/configLanguages\/list",
                        "\n",
                        "\/admin\/configAdditionalFields\/list"
                    ]
                }
            },
            {
                "type": "header",
                "name": "header_contact_form_fields",
                "label": "Display the following fields in the form:",
                "children": [
                    {
                        "type": "checkbox",
                        "name": "shouldDisplayNameField",
                        "label": "First and last name",
                        "defaultValue": 1
                    },
                    {
                        "type": "checkbox",
                        "name": "shouldDisplaySubjectField",
                        "label": "Subject",
                        "defaultValue": 1
                    },
                    {
                        "type": "checkbox",
                        "name": "shouldDisplayAdditionalFields",
                        "label": "Additional fields",
                        "defaultValue": 1
                    }
                ]
            }
        ]
    }
]