gppa_live_merge_tag_value

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Add Line Break Between Live Merge Tag Checkbox Values
  5. Since

Description

Filter the live merge tag value.

Usage

Apply to all fields and forms.

add_filter( 'gppa_live_merge_tag_value', 'my_custom_function' );

Apply to all fields on a specific form.

add_filter( 'gppa_live_merge_tag_value_FORMID', 'my_custom_function' );

Apply to a specific field on a specific form.

add_filter( 'gppa_live_merge_tag_value_FORMID_FIELDID', 'my_custom_function' );

Parameters

  • merge_tag_match_value string|int

    The value with which the live merge tag will be replaced.

  • merge_tag_match string

    The merge tag that is being replaced.

  • form array

    The current form object.

  • field_id int

    The field ID targeted by the current merge tag.

  • entry_values array

    An array of values that should be used to determine the value with which to replace the merge tag.

Examples

Add Line Break Between Live Merge Tag Checkbox Values

This snippet replaces the default comma that separates the selected choice values when replacing a Checkbox field’s merge tag with line breaks.

<?php
/**
 * Gravity Perks // Populate Anything // Add Line Break Between Live Merge Tag Checkbox Values
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 *
 * Instruction Video: https://www.loom.com/share/0cfd96b62c264b5faf48fa0498b49124
 */
// Update "123" with your form ID and "4" with your Checkbox field ID.
add_filter( 'gppa_live_merge_tag_value_123_4', function( $value, $merge_tag, $form, $field_id, $entry_values ) {
	$values = array_map( 'trim', explode( ',', $value ) );
	return implode( '<br>', $values );
}, 10, 5 );

Extract and return only the domain portion of an email address when replacing an Email field’s merge tag.

<?php
/**
 * Gravity Perks // Populate Anything // Extract Domain from Email Address
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 */
// Update "123" to your form ID; and "4" to your Email field ID.
add_filter( 'gppa_live_merge_tag_value_123_4', function( $value ) {
	$bits = explode( '@', $value );
	return array_pop( $bits );
} );

Since

This filter is available since Gravity Forms Populate Anything 1.0-beta-4.35.