vfbp_field_default

Description

Filter the field's default "value" property.

Changing this value will alter the default value that is displayed and will most commonly be used by WPML users.

Parameters

$default
(string) (required) The field default value
Default: The field default value

$field_id
(int) (optional) The field ID
Default: the field ID

$form_id
(int) (optional) The form ID
Default: the form ID

Examples

Change the default value of a field based on the language if the  WPML plugin is installed:

add_filter( 'vfbp_field_default', 'filter_vfbp_field_default', 10, 3 );

function filter_vfbp_field_default( $default, $field_id, $form_id ){    
    // if the WPML plugin is not installed, return the default field name
    if ( !defined( 'ICL_LANGUAGE_CODE' ) )
        return $default;

    // the ICL_LANGUAGE_CODE constant is part of the WPML plugin (wpml.org)
    if ( ICL_LANGUAGE_CODE == 'en' )
        $default = 'Default Value';
    elseif ( ICL_LANGUAGE_CODE == 'fr' )
        $default = 'Valeur par défaut';

    return $default;
}