WPML
wpml_forms_config_ninja-forms
Loại
filter
Danh mục
Khác
Phiên bản WPML
4.9.2

Miêu tả

Sử dụng bộ lọc này khi bạn cần sửa đổi nội dung cấu hình trong wpml-forms-config.xml theo cách an toàn trước các bản cập nhật, hoặc khi bạn đang phát triển một plugin/giao diện yêu cầu điều này.

$config được tạo dựa trên wpml-forms-config.xml và có thể có cấu trúc phức tạp, vì vậy tốt nhất là trước tiên hãy thực hiện các thay đổi trong wpml-forms-config.xml, sau đó xem trước và xây dựng lại cấu trúc mảng cho sửa đổi mà bạn quan tâm — xem ví dụ trong phần Cách sử dụng hook.

Lưu ý: Bộ lọc này có sẵn trong Ninja Forms ML 0.5.0 trở lên.

Đối số

apply_filters( “wpml_forms_config_ninja-forms”, array $config );

$config
– (array)(Bắt buộc) Cấu hình được xác định trong wpml-forms-config.xml cho plugin này, được chuyển đổi thành định dạng mảng.

Ví dụ sử dụng

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

Tất cả 30 hook Khác →