wordpress - Gravity Forms List, output fields in a row as a group, not by column -


i trying "loop" through list in gravity forms using merge tags, however, answers each column in comma separated list instead of entire "row" of answers, , next row of answers.

for example, let's have multi-column list asks age, weight, height, , eye color. put in first 4 answers, hit plus button add row. if input 3 rows so:

group/row 1: 25, 180, 75, blue
group/row 2: 32, 190, 72, brown
group/row 3: 48, 210, 68, green

what want 3 sentences:
"your age 25 , weigh 180 , stand 75 inches tall , have blue eyes".
"your age 32 , weigh 190 , stand 72 inches tall , have brown eyes".
"your age 48 , weigh 210 , stand 68 inches tall , have reeng eyes".

however getting is....
"your age 25, 32, 48 , weigh 180, 190, 210 , stand 75, 72, 68 inches tall , have blue, brown, green eyes."

my current merge tag on confirmation page looks this:

your age {age:20} , weigh {weight:21} , stand {height:22} inches tall , have {eyes;23} eyes. 

i added following functions.php call each field directly, need way "loop" answers fit sentence:

add_filter( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value ) { if ( $field->type == 'list' && $merge_tag != 'all_fields' && is_numeric( $modifier ) ) {     // count actual number of columns     $choices      = $field->choices;     $column_count = count( $choices );      if ( $column_count > 1 ) {         // subtract 1 column number choices array 0 based         $column_num = $modifier - 1;          // column label can use key multi-column values         $column = rgars( $choices, "{$column_num}/text" );          // list fields values $entry         $values        = unserialize( $raw_value );         $column_values = array();          foreach ( $values $value ) {             $column_values[] = rgar( $value, $column );         }          $value = gfcommon::implode_non_blank( ', ', $column_values );     } }  return $value; }, 10, 5 ); 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -