.toml file (settings file)

Caution
Since AForms v1.2.7, the format of the settings file has changed from .ini to .toml.
While we support .ini for the time being, we recommend you migrate from .ini to .toml.

Although uncommon for WordPress plugins, AForms has a settings file.

Why there is a settings file

We, AForms developers, assume that the site creator and the site owner are separate.

The fact that the design can be customized with scss, comes from the same idea. Usually, the site owner cannot edit scss.

So, making “the creator of the site create a better site faster” is one of the hidden goals that AForms aims for.

When a site creator wants to control the behavior of AForms, it is the settings file to do so in the easiest way.

The settings file exists to change the default behavior of AForms. AForms works fine without the settings file.

The sample of the settings file

AForms comes with a sample settings file. It is located at:

wp-content/plugins/aforms/aforms.toml.sample

Use this as a template for your settings file. To enable it, change the file name to aforms.toml.

The format of the settings file

The settings file is in toml format.
  • Parameters (Entries)
    Write setting in the style of name = value. name is the parameter name, and value is the parameter value. To setup AForms, both should be enclosed in ".
  • Sections
    Sections are written in [secion] format. Sections are to separate parameters for their groups.
  • Comment line
    Comment lines are written in # comment format.

See below for details on toml format:
https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md

“general” section

The AForms settings file has the general section and the words section.

The general section is for general settings for AForms. There is only one parameter that can be set in the general section.

  • stylesheet:
    Sets the css style sheet for forms.
    Specify the path (without a leading slash) from the theme folder of the active theme.
    If this parameter is set, the specified style sheet will be used when displaying the form, instead of the style sheet included with AForms.

“words” section

In words section you can set the wording used in AForms. There are a lot of parameters because you can set all the words used in the form.

The name of the parameter is the “text itself” enclosed in ". Since the AForms text was originally written in English, the parameter name is in English.

Write the word you want to display in the parameter value.

  • When you want to set the parameter value to multiple lines:
    Surround the parameter value with """. It is OK if there is a line break in between.
  • When you want to include " in the parameter value:
    Write \" instead of ".

The list of words that can be set is listed in List of words that can be set.

Installation location

The configuration file should be placed in the theme folder of the active theme or in the AForms plugin folder. We highly recommend the former. The file name is aforms.toml.

Practical Examples

1. Change the label of the button

By default, the form submit button is labeled “Submit”, but this is not always appropriate. In this example, let’s change the label of the submission button to “Apply with this quote”.

"Submit" = "Apply with this quote"

Add the above parameter to the [words] section of the settings file.

2. Change currency to euro

To change the currency notation, change the units displayed before and after the price. the euro symbol is usually written before the amount, while some currency is written after the amount.

"$pricePrefix" = "€"
"$priceSuffix" = ""

In addition, it is necessary to change the detail line of the thank-you email. The following parameter is special because it instructs how to combine words. Please watch the following line with imagine: In the place %s is written, the product name, quantity and price will be entered.

"%s (x %s) $%s" = "%s (x %s) €%s"

Write the above three settings in the [words] section of the settings file.

0 0