Last active
          August 29, 2023 21:24 
        
      - 
      
- 
        Save rafaehlers/c89fafc84998de986c67c8c2f6ccf39e to your computer and use it in GitHub Desktop. 
    List Field Merge Tag Modifier to convert text URLs into clickable links
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php // DO NOT COPY THIS LINE | |
| add_filter( 'gform_merge_tag_filter', 'gv_list_columns', 30, 6 ); | |
| function gv_list_columns( $value, $merge_tag, $modifier, $field, $raw_value, $format ) { | |
| if ( $field->type == 'list' && $merge_tag != 'all_fields' && 'urlify' === $modifier ) { | |
| $values = unserialize( $raw_value ); | |
| $output = '<ul>'; | |
| foreach ( $values as $value ) { | |
| $output .= '<li><a href="'.$value.'">'.$value.'</a></li>'; | |
| } | |
| $value = $output.'</ul>'; | |
| } | |
| return $value; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Usage: {Listfield:1:urlify} where 'Listfield:1' is the proper Merge Tag for your List field (1 column) containing URLs