• Home
  • Pricing
  • Free Resources
  • About
  • Docs
  • Support
  • Account

Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Pricing
  • Blog
    • Free Resources
    • About
  • Support
    • Docs
    • Support
    • Account

gppa_array_value_to_text

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Use Newline As The Delimiter for Paragraph Text fields
    2. Remove Default Behavior of Using a Comma as a Delimiter
  5. Since

Description

This filter allows you to modify how array/JSON values are converted into text for text-based fields such as the Single Line Text field.

Usage

add_filter( 'gppa_array_value_to_text', 'your_function_name', 10, 6 );

Parameters

  • $text_value string

    The text which will be displayed in the text-based fields. This parameter will be unused in most cases unless you are chaining filters.

  • $array_value array

    The array value needing to be converted to a string.

  • $field GF_Field

    Current field.

  • $object array or object

    The object that the template is pulling from.

  • $object_type GPPA_Object_Type

    Current object type. Can be Post, User, Taxonomy, GF Entry, or Database.

  • $objects array or object

    The objects returned in the original query.

Examples

Use Newline As The Delimiter for Paragraph Text fields

<?php
/**
 * Gravity Perks // GP Populate Anything // Use Newline As The Delimiter for Paragraph Text fields
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 */
add_filter( 'gppa_array_value_to_text', function( $text_value, $array_value, $field ) {
	if ( $field->type !== 'textarea' ) {
		return $text_value;
	}
	return implode( "\n", $array_value );
}, 11, 3 );

Remove Default Behavior of Using a Comma as a Delimiter

<?php
/**
 * Gravity Perks // GP Populate Anything // Remove Default Behavior of Using a Comma as a Delimiter
 * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
 */
add_filter( 'gppa_array_value_to_text', function( $text_value, $array_value ) {
	return json_encode( $array_value );
}, 11, 2 );

Since

This filter is available since GP Populate Anything 1.0-beta-3.4.

All Perks

  • GF Address Autocomplete
  • GF Advanced Calculations
  • GF Advanced Phone Field
  • GF Auto List Field
  • GF Auto Login
  • GF Better User Activation
  • GF Blocklist
  • GF Conditional Logic Dates
  • GF Conditional Pricing
  • GF Copy Cat
  • GF Date Time Calculator
  • GF Disable Entry Creation
  • GF Easy Passthrough
  • GF eCommerce Fields
  • GF Email Users
  • GF Entry Blocks
  • GF Expand Textareas
  • GF File Renamer
  • GF File Upload Pro
  • GF Google Sheets
  • GF Inventory
  • GF Limit Checkboxes
  • GF Limit Choices
  • GF Limit Dates
  • GF Limit Submissions
  • GF Live Preview
  • GF Media Library
  • GF Multi-Page Navigation
  • GF Nested Forms
  • GF Notification Scheduler
  • GF Page Transitions
  • GF Pay Per Word
  • GF PayPal One-time Fee
  • GF Placeholder
  • GF Populate Anything
  • GF Post Content Merge Tags
  • GF Preview Submission
  • GF Price Range
  • GF QR Code
  • GF Randomizer
  • GF Read Only
  • GF Reload Form
  • GF Terms Of Service
  • GF Unique ID
  • GF Word Count

Copyright © 2023 · Powered by WordPress · Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Terms & Conditions of Use
  • Privacy Policy
  • Cookies Policy