Created
August 23, 2012 20:31
-
-
Save tylerdigital/3441310 to your computer and use it in GitHub Desktop.
Create a Gravity Form dropdown with custom array values
This file contains 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
add_filter('gform_pre_render', 'tdgf_favorite_food'); | |
function tdgf_favorite_food($form) { | |
if(empty($form['fields'])) return; | |
foreach ($form['fields'] as $key => &$field) { | |
if($field['cssClass']!='favorite_food' || empty($field['choices'])) continue; | |
$field['choices'] = array('apples' => 'Apples', 'oranges' => 'Oranges'); | |
} | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment