Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
Use this hook to filter the global JS data.
Formidable Forms is the best WordPress Form Builder plugin. Get it for free!
Usage
add_filter('frm_acf_global_js_data', 'acf_global_js_data', 10, 2);
Parameters
- $data (array): The JS data.
- $args (array): Contains "form_id" (int).
Examples
Add custom data to the global JS
add_filter('frm_acf_global_js_data', 'acf_global_js_data', 10, 2);
function acf_global_js_data( $data, $args ) {
$data['form_object'] = FrmForm::getOne( $args['form_id'] );
$data['strings']['custom_string'] = 'Your custom string';
$data['custom_data'] = 'Your custom data';
return $data;
}