Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.

Jump To Section

Description #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 #parameters

$localised | array
An associative array that gets output in our GFPDF JavaScript object.

Usage #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 #source-code

This filter is located in the Helper_Data::get_localised_script_data() method of /src/helper/Helper_Data.php.

Signup for the latest Gravity PDF news, tips and updates

  • This field is for validation purposes and should be left unchanged.
Scroll To Top