-
-
Save dgoze/d797fe4e6a082f732c3a2dbf6482cd33 to your computer and use it in GitHub Desktop.
Populate ACF Select Field with Gravity Forms
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 | |
| function populate_gravity_forms($field) { | |
| echo '<h1>acf/load_field filter debug within populate_gravity_forms()</h1>'; | |
| if(class_exists('RGFormsModel')) { | |
| $forms_array = array(); | |
| $forms = RGFormsModel::get_forms(null, 'title'); | |
| foreach($forms as $form) { | |
| $forms_array[$form->id] = $form->title; | |
| } | |
| $field['choices'] = $forms_array; | |
| } | |
| return $field; | |
| } | |
| add_filter('acf/load_field/name=subscribe-form-header', 'populate_gravity_forms'); | |
| add_filter('acf/load_field/name=subscribe-form-header-tablet', 'populate_gravity_forms'); | |
| add_filter('acf/load_field/name=subscribe-form-footer', 'populate_gravity_forms'); | |
| add_filter('acf/load_field/name=contact-form', 'populate_gravity_forms'); | |
| add_filter('acf/load_field/name=the-popup-form', 'populate_gravity_forms'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment