I am adding Gravity Forms to Unyson builder but problem is the builder only detects/adds the last form title/id.
Here is the code:
if ( ! defined( 'FW' ) ) {
die( 'Forbidden' );
}
$options = array(
'title' => array(
'type' => 'select',
'value' => 'choice-3',
'attr' => array( 'class' => 'custom-class', 'data-foo' => 'bar' ),
'label' => __('Label', 'fw'),
'desc' => __('Description', 'fw'),
'help' => __('Help tip', 'fw'),
'choices' => array(),
), // title
); // $options
$forms = GFAPI::get_forms();
foreach ($forms as $form) {
$form_id = $form['id'];
$form = GFAPI::get_form( $form_id );
$form_title = $form['title'];
$options['title']['choices'] = array(
$form_id => __($form_title, 'fw'),
);
}
I want to populate the 'choices' array with all the gravity forms titles.
Thank you!