{"id":817,"date":"2021-11-09T10:53:54","date_gmt":"2021-11-09T10:53:54","guid":{"rendered":"https:\/\/mklasen.com\/?p=817"},"modified":"2021-11-09T10:53:55","modified_gmt":"2021-11-09T10:53:55","slug":"populating-an-acf-dropdown-with-forms-from-gravity-forms","status":"publish","type":"post","link":"https:\/\/mklasen.com\/populating-an-acf-dropdown-with-forms-from-gravity-forms\/","title":{"rendered":"Populating an ACF dropdown with forms from Gravity Forms"},"content":{"rendered":"\n
No need to explain, let’s dive into code!<\/p>\n\n\n\n
add_filter( 'acf\/load_field\/name=donation_form', array( $this, 'populate_forms' ) );<\/code><\/pre>\n\n\n\n\tpublic function populate_forms( $field ) {\n\t\t$choices = array(\n\t\t\t'select' => '-- Select a form',\n\t\t);\n\t\t$forms = \\GFAPI::get_forms();\n\t\tforeach ( $forms as $choice ) {\n\t\t\t$choices[ $choice['id'] ] = $choice['title'];\n\t\t}\n\t\t$field['choices'] = $choices;\n\t\treturn $field;\n\t}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"No need to explain, let’s dive into code!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[1],"tags":[],"acf":[],"yoast_head":"\n
Populating an ACF dropdown with forms from Gravity Forms - Marinus Klasen<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n\n\n\n\n\n\t\n\t\n\t\n