Configuration 

Site settings 

The following settings are exposed through the site set and can be overridden per site.

Name Type Default
string Form
handlebars_forms.view.templateName
Type
string
Default
Form

Name of the Handlebars template used for rendering a form when no per-form template is configured. Corresponds to a template file in the configured Handlebars template root paths, e.g. Form.hbs.

TypoScript 

The site set sets up a TypoScript object at plugin.tx_form.handlebarsForms , where integrators define how each form is rendered. The structure is:

plugin.tx_form.handlebarsForms {
    # Applied to every form (fallback)
    default {
        templateName = {$handlebars_forms.view.templateName}

        dataProcessing {
            10 = process-form
            10 {
                # ... HBS_* configuration
            }
        }
    }

    # Override for a specific form – merged on top of "default"
    my_contact_form {
        templateName = ContactForm
    }
}
Copied!

Each block is passed to a HANDLEBARSTEMPLATE content object provided by EXT:handlebars. This means all of its properties can be used, e.g. templateRootPaths and partialRootPaths to configure form-specific template paths, or variables to pass additional values to the template.

When a form is rendered, the extension looks up configuration blocks in the following order. All matching blocks are merged, with later entries winning:

  1. default – applied to every form
  2. Form unique identifier (e.g. my-contact-form-123 )
  3. Original form identifier before suffixes are appended (e.g. my-contact-form )
  4. Form persistence identifier (the YAML file path, e.g. EXT:my_extension/Resources/Private/Forms/ContactForm.form.yaml )

Per-form overrides 

To use a different template or a different data structure for a specific form, add a block keyed by one of the identifiers listed above. It is merged on top of default :

plugin.tx_form.handlebarsForms {
    my_contact_form {
        templateName = ContactForm

        dataProcessing {
            10 = process-form
            10 {
                fields =< plugin.tx_form.handlebarsForms.default.dataProcessing.10.fields
                fields {
                    # Extra field type only present in this form
                    Rating {
                        template = @form-field-rating

                        value = HBS_TAG
                        value.attribute = value
                    }
                }
            }
        }
    }
}
Copied!

Template context 

The templateName key names the Handlebars template file (without extension) that receives the data produced by the process-form processor as its template context.

See Conditions in the processor reference for details on using if to conditionally omit keys from the output.