<?php
/**
* Populate ACF select field options with Gravity Forms forms
*/
function acf_populate_gf_forms_ids( $field ) {
if ( class_exists( 'GFFormsModel' ) ) {
$choices = [];
$choices[0] = 'Bitte Formular aussuchen...';
foreach ( \GFFormsModel::get_forms() as $form ) {
$choices[ $form->id ] = $form->title;
}
$field['choices'] = $choices;
}
return $field;
}
add_filter( 'acf/load_field/name=gf_anmeldeformular', 'acf_populate_gf_forms_ids' );
?>