We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
gppa-replace-new-lines.php
1 parent 42774c5 commit 89a706cCopy full SHA for 89a706c
gp-populate-anything/gppa-replace-new-lines.php
@@ -0,0 +1,18 @@
1
+<?php
2
+/**
3
+ * Gravity Perks // Populate Anything // Handle New Lines
4
+ * https://gravitywiz.com/documentation/gravity-forms-populate-anything/
5
+ *
6
+ * Replace the `\n` new line terminator with an actual new line in template values. This is particularly
7
+ * useful in custom templates for Paragraph fields where you are outputting multiple object values.
8
9
+ * Example:
10
11
+ * ID: {post:ID}\nAuthor: {post:post_author}\nDate: {post:post_date}
12
+ */
13
+add_filter( 'gppa_process_template_value', function( $value, $field ) {
14
+ if ( ! is_array( $value ) ) {
15
+ $value = str_replace( '\n', "\n", $value );
16
+ }
17
+ return $value;
18
+}, 10, 2 );
0 commit comments