Version: 5
🔥 Gravity PDF v5 end of life was 2023-04-28 and this version is no longer supported. This legacy documentation is kept for reference only.
gfpdf_localised_script_array
Description
The array returned by this filter gets passed directly to wp_localize_script()
. You can use it to pass in additional values or modify existing values in the GFPDF
JavaScript object which gets automatically included when the gfpdf_js_settings
script is loaded.
Parameters
$localised | array
- An associative array that gets output in our
GFPDF
JavaScript object.
Usage
The following snippet can be used to change output of an existing record:
add_filter( 'gfpdf_localised_script_array', function( $localised ) {
/* Change the text of our successful update message */
$localised['update_success'] = __( 'The update went well!', 'prefix-text-domain' );
return $localised;
} );
You can also add new data to the array:
add_filter( 'gfpdf_localised_script_array', function( $localised ) {
/* Add a new record. Make sure you prefix it to prevent any conflict with existing array keys */
$localised['prefix_alert_problem'] = __( 'Something went wrong with the custom functionality...', 'prefix-text-domain' );
return $localised;
} );
Source Code
This filter is located in the Helper_Data::get_localised_script_data()
method of /src/helper/Helper_Data.php
.