Note: This tutorial series is intended for advanced users. An advanced understanding of coding in PHP and JavaScript is required.
Module settings are defined in the get_fields()
method of the module’s PHP class. A setting definition is simply an associative array of parameters.
Required Parameters
type (
string
) — The field type used to render the setting in the module settings modal
Optional Parameters
default (
string
) — Default valuedescription (
string
) — Description (localized)id (
string
) — CSS id for the setting’s fieldlabel (
string
) — Display name (localized)option_category (
string
) — Option category slug (for the Divi Role Editor)tab_slug (
string
) — Modal tab slugtoggle_slug (
string
) — Modal tab settings group toggle slug
Field Types
The Divi Builder has a comprehensive selection of field types for module settings. Below is a list of available field types, each with a screenshot and a list of any additional parameters that must be included in the setting definition.
The value to use for the type
The parameter of the setting definition is in parenthesis next to each field type's name.
Text (text)
Select (select)
Select Field Parameters
options (
array
) — Option slugs mapped to their display names (localized)
Checkboxes (multiple_checkboxes)
Checkboxes Field Parameters
options (
array
) — Option slugs mapped to their display names (localized)
Toggle Button (yes_no_button)
Toggle Button Field Parameters
options (
array
)off (
string
) — Display the name of the off-state (localized)on (
string
) — Display the name of the on-state (localized)
Range Slider (range)
Range Slider Field Parameters
range_settings (array)
min (
string
) — Minimum valuemax (
string
) — Maximum valuestep (
string
) — Minimum distance between values when using the slider
validate_unit (
bool
) — Whether or not to validate the unit.