wpml_forms_config_ninja-forms
- 类型
- filter
- 类别
- 杂项
- WPML 版本
- 4.9.2
说明
当您需要修改 wpml-forms-config.xml 中的配置内容且希望修改不受更新影响时,或者当您正在开发需要此功能的插件/主题时,请使用此过滤器。
$config 是基于 wpml-forms-config.xml 创建的,并且可能具有复杂的结构,因此最好先在 wpml-forms-config.xml 中进行更改,然后预览并为您感兴趣的修改重构数组结构——请参阅钩子用法中的示例。
注意:此过滤器在 Ninja Forms ML 0.5.0 及更高版本中可用。
参数
apply_filters( “wpml_forms_config_ninja-forms”, array $config );
$config
– (array)(必填) 在 wpml-forms-config.xml 中为此插件定义的配置,已转换为数组格式。
使用示例
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;
} );
相关钩子
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