wpml_forms_config_ninja-forms
- Type
- filter
- Category
- Miscellaneous
- WPML Version
- 4.9.2
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 Ninja Forms ML 0.5.0 and later.
Arguments
apply_filters( “wpml_forms_config_ninja-forms”, array $config );
$config
– (array)(Required) The configuration defined in wpml-forms-config.xml for this plugin, converted into an array format.
Example usage
add_filter( 'wpml_forms_config_ninja-forms', 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_ninja-forms', function ( array $config ): array {
// add modifications here
var_export( $config );
return $config;
} );
Related hooks
icl_ls_languages, wpml_sync_custom_field_copied_value, wpml_ls_enable_ajax_navigation, wpml_element_type, wpml_setting, wpml_sub_setting, wpml_exclude_post_from_auto_translate, wpml_forms_config_wpforms, wpml_tf_feedback_open_link, wpml_translatable_user_meta_fields