• Resolved sergiarias

    (@sergiarias)


    Hello! I’m coming from gravity after a lot of developers recommended to switch to htmlforms. Definitely considering the premium option!

    I use acf in it’s programmatic way to create blocks and pages, and I usually like to give a select field with all the forms to choose from. I could hardcode it, but I would prefer to get it dynamically.

    In gravity, I would do:

    $forms = \GFAPI::get_forms();

    and this would give an array with a lot of info, in this case id and title that I would use like so:

    
    foreach ($forms as $key => $form) {
     $options
      ->getField('newsletter_form')
      ->addChoice($form['id'], $form['title'])
     ;
    }
    

    Not an important feature, but definitely would make the code neattier.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get list of form slugs for acf’ is closed to new replies.