Advertisement
chrishajer

all_fields:exclude merge tag

Aug 26th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. // Help Scout 30310 Richard Vav
  3. // exclude field from {all_fields} merge tag by adding
  4. // :exclude to merge tag
  5. add_filter( 'gform_merge_tag_filter', 'exclude_from_all_fields', 10, 4 );
  6. function exclude_from_all_fields ( $value, $merge_tag, $options, $field ) {
  7.     $options_array = explode ( ",", $options );
  8.     $exclude = in_array ( "exclude", $options_array );
  9.    
  10. // if a field has the CSS Class Name gf_exclude the field will be excluded from the {all_fields:exclude} merge tag
  11.     if ( $merge_tag == "all_fields" && $exclude == true && $field["cssClass"] == "gf_exclude" )
  12.         return false;
  13.     else
  14.         return $value;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement