Using the gform_field_css_class action I am able to ensure that the following logic only gets executed against a particular form by CSS class on the form. I'm distributing the form for others to import, so cannot use the form # since it changes per import / site.
add_action("gform_field_css_class", "class_silent"), 10, 3);
function class_silent($classes, $field, $form){
$auctionFormType = strpos($form['cssClass'], 'idealien_auctions');
if( $auctionFormType === false )
return $classes;
if($field['inputName'] == "displayName"){
$classes .= " hidden ";
}
return $classes;
}
The parameters for gform_field_choices filter does not include $form to do the same logic. Is there another recommended approach to ensure the modification to choices does not occur outside of the intended form?