Configuration
Create a formie.php file under your /config directory with the following options available to you. You can also use multi-environment options to change these settings per environment.
The example below shows the defaults already used by Formie, so you only need to add the settings you want to change.
<?php
return [
'*' => [
'pluginName' => 'Formie',
'defaultPage' => 'forms',
'compatibilityMode' => true,
'staticCacheRefreshOnLoad' => false,
// Forms
'validateCustomTemplates' => true,
'defaultFormTemplate' => '',
'defaultEmailTemplate' => '',
'enableUnloadWarning' => true,
'enableBackSubmission' => true,
'ajaxTimeout' => 10,
'filterIntegrationMapping' => true,
'includeDraftElementUsage' => false,
'includeRevisionElementUsage' => false,
'outputConsoleMessages' => true,
// General Fields
'disabledFields' => [],
'defaultLabelPosition' => \verbb\formie\positions\AboveInput::class,
'defaultInstructionsPosition' => \verbb\formie\positions\AboveInput::class,
// Fields
'defaultFileUploadVolume' => '',
'allowPublicVolumes' => true,
'defaultDateDisplayType' => 'calendar',
'defaultDateValueOption' => '',
'defaultDateTime' => null,
'enableLargeFieldStorage' => false,
'plainTextHtmlSanitizationMode' => 'preserve',
// Submissions
'maxIncompleteSubmissionAge' => 30,
'enableCsrfValidationForGuests' => true,
'useQueueForNotifications' => true,
'useQueueForIntegrations' => true,
'queuePriority' => null,
'setOnlyCurrentPagePayload' => false,
'submissionsBehaviour' => 'all',
'submissionStateRetentionDays' => 30,
'saveResumeTokenTtlDays' => 14,
'maxSavedDraftsPerSession' => 10,
'anonymousClientBootstrapRateLimit' => 30,
'anonymousClientRefreshRateLimit' => 120,
'anonymousClientRateWindowSeconds' => 60,
// Sent Notifications
'sentNotifications' => true,
'maxSentNotificationsAge' => 30,
// Spam
'saveSpam' => true,
'spamLimit' => 500,
'spamEmailNotifications' => false,
'spamBehaviour' => 'showSuccess',
'spamKeywords' => '',
'spamBehaviourMessage' => '',
// Email Notifications
'sendEmailAlerts' => false,
'alertEmails' => null,
'emptyValuePlaceholder' => 'No response.',
// PDFs
'pdfPaperSize' => 'letter',
'pdfPaperOrientation' => 'portrait',
// Theme
'themeConfig' => [],
'useCssLayers' => false,
// Captchas
'captchas' => [],
// Export
'defaultExportFolder' => '@storage/formie-export',
],
];Configuration options
pluginNamesets a custom name for the plugin.defaultPagesets the default Formie control panel page when clicking Formie in the main navigation.compatibilityModeenables compatibility shims for older Formie APIs during an upgrade.staticCacheRefreshOnLoadallows rendered forms to refresh request-specific values when initialized on statically cached pages. Formie also treats this as enabled when Blitz is installed and enabled.
Forms
validateCustomTemplateschecks that custom form template paths exist before they are saved.defaultFormTemplatesets the default form template handle used for new forms.defaultEmailTemplatesets the default email template handle used for new email notifications.enableUnloadWarningshows an unload warning when a user changes a front-end form and tries to leave without submitting.enableBackSubmissionsubmits the current page content when a user clicks the Back button on a multi-page form.ajaxTimeoutsets the timeout in seconds for Ajax requests made by Formie’s front-end JavaScript.filterIntegrationMappingfilters field-mapping options shown in integrations to fields that are usually suitable for the target setting.includeDraftElementUsageincludes draft elements when Formie checks where a form is used.includeRevisionElementUsageincludes revision elements when Formie checks where a form is used.outputConsoleMessagescontrols whether Formie’s front-end JavaScript can output console messages.
General Fields
disabledFieldsis an array of field classes that should be disabled and unavailable in the form builder.defaultLabelPositionsets the default label position for new forms and fields.defaultInstructionsPositionsets the default instruction position for new forms and fields.
Fields
defaultFileUploadVolumesets the asset volume used as the default for new File Upload fields. Use thefolder:uidformat.allowPublicVolumesallows File Upload fields to use public asset volumes.defaultDateDisplayTypesets the default display type for new Date fields. Usecalendar,dropdowns, orinputs.defaultDateValueOptionsets the default value mode for new Date fields. Usetodayordate.defaultDateTimesets the default date whendefaultDateValueOptionisdate.enableLargeFieldStoragestores field content in large-text database columns for projects that expect very large submission payloads.plainTextHtmlSanitizationModecontrols how plain-text input values are handled when HTML is submitted. Usepreserveorsanitize.
Submissions
maxIncompleteSubmissionAgesets the maximum age of incomplete submissions in days before they are deleted during garbage collection. Set to0to disable automatic deletion.enableCsrfValidationForGuestsenables Craft’s CSRF validation checks for anonymous form submissions.useQueueForNotificationssends email notifications through Craft’s queue. This is recommended for production sites so form submissions are not slowed down by email delivery.useQueueForIntegrationssends integrations through Craft’s queue. This is recommended for production sites so form submissions are not slowed down by third-party APIs.queuePrioritysets the Craft queue priority for notification and integration jobs.setOnlyCurrentPagePayloadlimits multi-page form payloads to the current page when processing a page request.submissionsBehaviourcontrols which submissions are saved. The default isall.submissionStateRetentionDayssets how long incomplete submission state can be kept for save-and-resume and front-end submission state.saveResumeTokenTtlDayssets how long a save-and-resume token remains valid.maxSavedDraftsPerSessionlimits how many saved drafts can be created in one browser session.anonymousClientBootstrapRateLimitlimits anonymous client bootstrap requests within the configured rate window. Set to0to disable the limit.anonymousClientRefreshRateLimitlimits anonymous token-refresh requests within the configured rate window. Set to0to disable the limit.anonymousClientRateWindowSecondssets the rate-limit window used by anonymous client bootstrap and token-refresh requests.
Security-sensitive runtime settings
- Keep
allowedGraphqlOriginsas narrow as possible when using headless/runtime forms. Avoid wildcard or broad origins when credentialed requests are allowed. - Public GraphQL schemas should only include the Formie form and submission scopes required by the front-end consuming them.
- Keep
enableCsrfValidationForGuestsenabled unless you have a specific headless/runtime integration that cannot submit CSRF tokens.
Sent Notifications
sentNotificationsenables Sent Notifications.maxSentNotificationsAgesets the number of days to keep sent notifications before they are deleted permanently. Set to0to disable automatic deletion.
Spam
saveSpamsaves spam submissions to the database.spamLimitlimits how many saved spam submissions are kept.spamEmailNotificationsallows submissions marked as spam to still trigger email notifications.spamBehaviourcontrols what the user sees when a spam submission is detected. UseshowSuccessorshowMessage.spamKeywordsmarks a submission as spam when the submitted content matches the configured keywords.spamBehaviourMessagesets the message shown whenspamBehaviourisshowMessage. HTML and Markdown are supported.
Email Notifications
sendEmailAlertssends an alert email when an email notification fails to send.alertEmailssets the name and email address pairs that should receive alert emails.emptyValuePlaceholdersets the placeholder used when a field has no submitted value in email output.
PDFs
pdfPaperSizesets the paper size for generated PDFs.pdfPaperOrientationsets the paper orientation for generated PDFs.
Theme
themeConfigsets the default theme configuration used when rendering forms and fields.useCssLayersoutputs Formie’s front-end CSS inside a CSS cascade layer.
Captchas
captchasstores project-config-backed captcha settings.
Export
defaultExportFoldersets the default folder used by form export console commands.
Control Panel
You can also manage many configuration settings through the control panel by visiting Formie → Settings.
Alerts Configuration
Supply a nested array for the name and email of each contact to receive alert notifications. The first value should contain the name, and the second value should contain the email address.
'alertEmails' => [
['Primary Name', '[email protected]'],
['Secondary Admin Name', '[email protected]'],
],Theme Configuration
Supply a nested array for the configuration forms and fields should use when rendering.
'themeConfig' => [
'form' => [
'attributes' => [
'class' => 'contact-form',
],
],
'field' => [
'attributes' => [
'class' => 'contact-form-field',
],
],
],Continue reading Theme Config for more.
Rich Text Configuration
Formie uses rich-text fields for several form, notification, and field settings. You can control the toolbar buttons and visible rows for those fields by adding a rich-text.json file to a formie folder in your /config directory.
{
"forms": {
"errorMessage": {
"buttons": ["bold"],
"rows": 3
}
}
}This changes the forms.errorMessage rich-text field so it only shows the Bold button and uses three rows.
The default rich-text config is:
{
"forms": {
"submitActionMessage": {
"buttons": ["bold", "italic", "variableTag"],
"rows": 3
},
"errorMessage": {
"buttons": ["bold", "italic"],
"rows": 3
},
"requireUserMessage": {
"buttons": ["bold", "italic"],
"rows": 3
},
"scheduleFormPendingMessage": {
"buttons": ["bold", "italic"],
"rows": 3
},
"scheduleFormExpiredMessage": {
"buttons": ["bold", "italic"],
"rows": 3
},
"limitSubmissionsMessage": {
"buttons": ["bold", "italic"],
"rows": 3
},
"limitSubmissionsIpAddressMessage": {
"buttons": ["bold", "italic"],
"rows": 3
}
},
"fields": {
"agree": {
"buttons": ["bold", "italic", "link"],
"rows": 3
},
"calculations": {
"buttons": ["variableTag"],
"rows": 3
}
},
"notifications": {
"content": {
"buttons": ["bold", "italic", "variableTag"]
}
}
}Available Buttons
As shown above, your config can provide an array of button names to include in the rich-text field interface.
| Button | Description |
|---|---|
bold | Allows text to be bold. |
italic | Allows text to be italic. |
underline | Allows text to be underlined. |
strikethrough | Allows text to have a strikethrough. |
heading1 | Allows Heading 1 formatting. |
heading2 | Allows Heading 2 formatting. |
paragraph | Allows Paragraph formatting. |
quote | Allows Quote formatting. |
olist | Allows ordered lists. |
ulist | Allows unordered lists. |
code | Allows code formatting. |
line | Adds a horizontal line button. |
link | Allows links. |
image | Allows images. |
alignleft | Allows left alignment. |
aligncenter | Allows center alignment. |
alignright | Allows right alignment. |
clear | Clears formatting. |
variableTag | Allows variable tags where the field supports them. |
{
"buttons": ["bold", "italic", "link", "variableTag"],
"rows": 4
}