Skip to content

Commit 2ae6f9b

Browse files
authored
gpafp-replace-space-separator.php: Added a new snippet to replace the space separator. (#636)
1 parent a6caad2 commit 2ae6f9b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Advanced Phone Field // Replace the space separator.
4+
* https://gravitywiz.com/documentation/gravity-forms-advanced-phone-field/
5+
*
6+
* When the phone[nationalNumberFormatted] modifier is used, it seperates the phone number with a space.
7+
* This snippet allows you to change the space seperator.
8+
*/
9+
add_filter( 'gpapf_merge_tag_value', function( $text, $modifiers ) {
10+
if ( $modifiers['phone'] == 'nationalNumberFormatted' ) {
11+
// Update '-' to any character you want to use as the seperator.
12+
$text = str_replace( ' ', '-', $text );
13+
}
14+
return $text;
15+
}, 10, 2 );

0 commit comments

Comments
 (0)