Support » Plugin: Fresh Forms for Gravity » Support for ACF (Advanced Custom Fields)

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Samuel Aguilera

    (@samuelaguilera)

    Hi Daniel,

    Honestly I never thought of that use case. Which ACF field type are you using to embed the form?

    Thread Starter Daniel Maier

    (@demaier)

    Hi @samuelaguilera,

    That would be an awesome addition if you decide to support it.
    The fields we use are: Wysiwyg Editor, Text and Text Area.

    Thank you.

    Plugin Author Samuel Aguilera

    (@samuelaguilera)

    Hi Daniel,

    Can you please give a try to the development version that I have uploaded?
    You can download it using the Advanced View here at WordPress.org

    It worked fine for me during testing, but I would like to have your input too.

    Thread Starter Daniel Maier

    (@demaier)

    Hi @samuelaguilera,

    I just tried the development version and I still got the cache for the page using ACF text field to embed the Gravity Forms:

    cache-control: max-age=600, must-revalidate

    I have captured a couple screenshots:

    Field type: https://www.dropbox.com/s/fo382wm9hkqjmah/Fresh%20Gravity%20Forms%20-%20Field%20type.png?dl=0

    Shortcode: https://www.dropbox.com/s/9ldeezhpdr6rnhf/Fresh%20Gravity%20Forms%20-%20Shortcode.png?dl=0

    Thank you for working on this!

    Thread Starter Daniel Maier

    (@demaier)

    I looked at your code and I believe you also need to check using “get_sub_field_object” as well to cover the main fields and sub fields.

    The shortcode text field I’m using is a sub field.

    Thread Starter Daniel Maier

    (@demaier)

    @samuelaguilera this is how I have to load my shortcode text field in my template:

    $shortcode = get_sub_field(‘shortcode’);

    Instead of:

    $shortcode = get_field(‘shortcode’);

    • This reply was modified 1 year, 3 months ago by Daniel Maier.
    Plugin Author Samuel Aguilera

    (@samuelaguilera)

    Hi @demaier

    I forgot to tell you that you need to flush the cache first to let the new code run. Or go to the Plugins page and disable/enable Fresh Forms.

    But anyway, according to ACF documentation get_sub_field() is a function to get a specific sub field value from a Repeater or Flexible Content field loop. So if you’re using a repeater or flexible content field the development version is not going to work anyway as I made it to target only the field types you mentioned previously: WYSIWYG, text and text area. Therefore it will not check for fields inside a repeater or flexible content field.

    I’m not a regular ACF user, so I’ll need to check how those fields are handled and evaluate adding support for them.

    Thread Starter Daniel Maier

    (@demaier)

    @samuelaguilera yes, I forgot to mention that. We are indeed using our fields inside a flexible content field. That allows us to drag/drop these fields and reorganize how they are displayed.

    I believe if you add another check using get_sub_field_object (but also keeping get_field_object) to find the text, text area and WYSIWYG fields that may do the trick.

    Thanks again! 👍🏼

    Thread Starter Daniel Maier

    (@demaier)

    @samuelaguilera I see now that the function get_sub_field_object doesn’t return all of the subfields and apparently there’s not a built-in function for that in ACF.

    Here’s a few resources I found somewhat related to the subject:

    https://stackoverflow.com/questions/45437563/acf-get-all-fields-of-a-page-or-post-including-sub-fields

    https://support.advancedcustomfields.com/forums/topic/get-all-fields-sub-fields-of-a-post-repeater/

    https://dream-encode.com/acf-get-all-fields-in-a-field-group/

    Thanks!

    Plugin Author Samuel Aguilera

    (@samuelaguilera)

    Hi @demaier, I have uploaded a new development version that adds support for flexible_content subfields.

    It’s working for me during testing using subfields of the following types: text, text area, wysiwyg.

    Can you please give it a try? After installing it you need to:

    1. Add add the following line to your theme’s functions.php file or a custom functionality plugin.

    add_filter( 'freshforms_acf_support', '__return_true' );

    2. Flush your caching engine cache manually or go to the Plugins page and disable/enable Fresh Forms.

    Thread Starter Daniel Maier

    (@demaier)

    @samuelaguilera it looks like this is working! 🙂

    I have noticed that this doesn’t work if the field is a subfield of a repeater field. If that’s not too much trouble, it would be nice to have that support added as well, as you can add text, text area and wysiwyg under repeater fields as well.

    Repeater field item: https://www.dropbox.com/s/etpr6o89r78negu/Screen%20Shot%202020-08-24%20at%208.59.12%20AM.png?dl=0

    Repeater field setup: https://www.dropbox.com/s/6h4xygs0gk0418i/Screen%20Shot%202020-08-24%20at%208.59.39%20AM.png?dl=0

    Thanks for tweaking this. Awesome work!

    Thread Starter Daniel Maier

    (@demaier)

    Just FYI, these are the fields available with ACF:

    Basic
    Text
    Text Area
    Number
    Range
    Email
    Url
    Password
    Button
    Hidden
    Slug

    Layout
    Message
    Accordion
    Tab
    Group
    Repeater
    Flexible Content
    Clone
    Table
    Column
    Dynamic Message

    Content
    Image
    File
    Wysiwyg Editor
    oEmbed
    Gallery
    Code Editor

    Some of these fields come with the ACF Extended version.
    However, I believe only repeater and flexible content would allow the subfields that can be used to embed Gravity Forms.

    Hello,

    ACF Extended developer here. Here is a separated list for ACF Pro fields & ACF Extended fields. Please note that you forgot to mention “Choice”, “Relational” & “jQuery” fields:

    Here are the native ACF Pro fields:

    Basic
    Text
    Text Area
    Number
    Range
    Email
    Url
    Password

    Choice
    Select
    Checkbox
    Radio Button
    Button Group
    True/False

    Relational
    Link
    Post Object
    Page Link
    Relationship
    Taxonomy
    User

    Jquery
    Google Map
    Date Picker
    Date Time Picker
    Time Picker
    Color Picker

    Layout
    Message
    Accordion
    Tab
    Group (allow sub fields)
    Repeater (allow sub fields)
    Flexible Content (allow sub fields)
    Clone

    Content
    Image
    File
    Wysiwyg Editor
    oEmbed
    Gallery

    Here are the ACF Extended fields:

    Basic
    Button
    Hidden
    Slug

    Relational
    Advanced Link
    Forms
    Post statuses
    Post types
    Taxonomies
    Taxonomy Terms
    User Role

    Jquery
    reCAPTCHA

    Layout
    Column
    Dynamic Message

    Content
    Code Editor

    Hope it helps!

    Regards.

    Thread Starter Daniel Maier

    (@demaier)

    @hwk-fr thanks for backing up.

    Plugin Author Samuel Aguilera

    (@samuelaguilera)

    @demaier As mentioned in my previous messaged I added support only for the Flexible Content subfields, so not detecting forms for a Repeater field subfields is totally expected because I didn’t add support for this field type yet. I’ll look into it when I have some free time for it.

    Regarding to the ACF field types list, thanks for that, but I don’t think is needed to support all of them. For now I think that supporting text, text area and WYSIWYG as standalone or subfields is enough. If I get more requests for other ACF field types in the future I can consider extending ACF suport.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Support for ACF (Advanced Custom Fields)’ is closed to new replies.