Options can be extended with your own PHP function or an external JSON file or request.
Options
The default options are added to the form editor.
Options + PHP Function
If “Options + PHP function” is selected, the default options will be merged with your own PHP function. Otherwise, the plugin will only take the returned array from your function. Make sure that your PHP function can be called globally.
The value in the options_source option should be the name of your PHP function. In this example, the function name is ezfc_get_custom_options
. Below is the relevant PHP function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
function ezfc_get_custom_options() { $options = array( array( "text" => "Option label 1", "value" => 1, "id" => "id-1" ), array( "text" => "Option label 2", "value" => 2, "id" => "id-2" ), array( "text" => "Option label 3", "value" => 3, "id" => "id-3" ) ); return $options; } |
JSON URL
Enter the URL of your JSON file in the value. The plugin will get the contents of the JSON file and try to parse it.
You can read more about this in the JSON options article.
JSON URL, Options + JSON URL
Expected value: String/URL of the JSON file
Example: https://your-url.com/options.json