apply_filters( “wpml_forms_config_wpforms”, array $config );
Description
Use this filter when you need to modify the contents of the configuration in wpml-forms-config.xml in a way that is safe from updates, or when you’re developing a plugin/theme that requires this.
$config is created based on wpml-forms-config.xml and can have a complex structure, so it’s best to first make changes in wpml-forms-config.xml, then preview it and reconstruct the array structure for the modification you’re interested in — see the example in Hook usage.
Note: This filter is available in WPForms ML 0.5.0 and later.
Arguments
$configarrayRequiredThe configuration defined inwpml-forms-config.xmlfor this plugin, converted into an array format.
Example Usage
add_filter( 'wpml_forms_config_wpforms', function ( array $config ): array { $config['field']['my-custom-field'] = [ 'type' => 'ARRAY', 'properties' => 'f_label' ]; return $config; } ); /** * Developer Example * * How to persist the change in the simplest way: * 1. Modify the `wpml-forms-config.xml` file as needed to achieve the desired effect. * 2. Run the filter and execute `var_export( $config );` * - then locate the modified elements and apply them manually to `$config`. * - After that, you can restore the original `wpml-forms-config.xml` file * - verify that everything behaves correctly. */ add_filter( 'wpml_forms_config_wpforms', function ( array $config ): array { // add modifications here var_export( $config ); return $config; } );