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