From 686a3864ccc4b6bdbcb10ade7a1af2c80d9aa1e8 Mon Sep 17 00:00:00 2001 From: SebastianWiz <165194375+SebastianWiz@users.noreply.github.com> Date: Fri, 21 Nov 2025 11:14:29 -0800 Subject: [PATCH] `gw-default-choice-merge-tags-values.php`: Added new snippet to set choice-based merge tags to return values by default. --- .../gw-default-choice-merge-tags-values.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 gravity-forms/gw-default-choice-merge-tags-values.php diff --git a/gravity-forms/gw-default-choice-merge-tags-values.php b/gravity-forms/gw-default-choice-merge-tags-values.php new file mode 100644 index 000000000..f4ee0ddf3 --- /dev/null +++ b/gravity-forms/gw-default-choice-merge-tags-values.php @@ -0,0 +1,39 @@ +get_input_type(), array( 'select', 'radio', 'checkbox', 'multiselect', 'option', 'product', 'poll', 'survey', 'quiz', 'post_category' ), true ) ) { + continue; + } + + $modifiers = isset( $match[2] ) && $match[2] !== '' ? array_map( 'trim', array_map( 'strtolower', explode( ',', $match[2] ) ) ) : array(); + + // If any modifier is already present, honor it. + if ( $modifiers ) { + continue; + } + + $replacement = rtrim( $match[0], '}' ) . ( $match[2] === '' ? ':value}' : ',value}' ); + $text = str_replace( $match[0], $replacement, $text ); + } + + return $text; +}, 9, 7 );