Extending Form Builder¶
Existing Form fields¶
The Captcha Form field is based on Gregwar/CaptchaBundle.
You can customize the field by adding configuration to
1 2 3 4 5
For information about available options, see the bundle's documentation.
If your installation uses Varnish to manage content cache, you must modify the configuration to avoid issues with the Captcha field. For more information, see Ensure proper captcha behavior.
Extending Form fields¶
You can extend the Form Builder by adding new form fields or modifying existing ones. Form fields are defined in YAML configuration.
For example, to create a Country Form field:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Available attribute types are:
||List of available options|
Each type of Form field can have validators of the following types:
New types of fields require a mapper which implements
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
The mapper must be registered as a service:
1 2 3 4 5 6 7 8
Changing field and field attribute definitions dynamically¶
Field or field attribute definition can be modified by subscribing to one of the following events:
The following example adds the
readonly attribute to
single_line field definition.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
1 2 3 4 5
Accessing Form field definitions¶
Field definitions are accessible through:
\EzSystems\EzPlatformFormBuilder\Definition\FieldDefinitionFactoryin the back end
- global variable
eZ.formBuilder.config.fieldsConfigin the front end
Customizing email notifications¶
Email is one of the Submit button options you can choose from in the Form Builder. It allows you to list email addresses where notifications about newly filled forms should be sent to.
Override email template¶
To customize Form Builder submission notification, you need to override the
It contains two blocks: subject and body.
Each of them is rendered independently and consists of three sets of parameters.
||Name of the form, its Content Type|
||Definition of the form|
By adjusting them to your needs, you will change your email template.
Configure sender details¶
To send emails you also need to configure
It acts as a sender address and a return address where all bounced messages will be returned to.
You can learn more by visiting Symfony Mailer Configuration Reference.
Configure email notifications¶
To send emails, you need to configure
app/config/config.yml under the
It acts as a sender and return address for all bounced messages.
For details, see Symfony Mailer Configuration Reference.