Support for ACF (Advanced Custom Fields)
-
Hello Samuel,
Do you have any plans in supporting ACF (https://www.advancedcustomfields.com/)?
I noticed that your plugin doesn’t work if the Gravity Forms shortcode is used in a custom field.
Thanks for the great plugin!
-
Hi Daniel,
Honestly I never thought of that use case. Which ACF field type are you using to embed the form?
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.
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 www.ads-software.comIt worked fine for me during testing, but I would like to have your input too.
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!
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.
@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 4 years, 3 months ago by Daniel Maier.
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.
@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! ????
@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://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!
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.
- This reply was modified 4 years, 3 months ago by Samuel Aguilera.
@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!
Just FYI, these are the fields available with ACF:
Basic
Text
Text Area
Number
Range
Email
Url
Password
Button
Hidden
SlugLayout
Message
Accordion
Tab
Group
Repeater
Flexible Content
Clone
Table
Column
Dynamic MessageContent
Image
File
Wysiwyg Editor
oEmbed
Gallery
Code EditorSome 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
PasswordChoice
Select
Checkbox
Radio Button
Button Group
True/FalseRelational
Link
Post Object
Page Link
Relationship
Taxonomy
UserJquery
Google Map
Date Picker
Date Time Picker
Time Picker
Color PickerLayout
Message
Accordion
Tab
Group (allow sub fields)
Repeater (allow sub fields)
Flexible Content (allow sub fields)
CloneContent
Image
File
Wysiwyg Editor
oEmbed
GalleryHere are the ACF Extended fields:
Basic
Button
Hidden
SlugRelational
Advanced Link
Forms
Post statuses
Post types
Taxonomies
Taxonomy Terms
User RoleJquery
reCAPTCHALayout
Column
Dynamic MessageContent
Code EditorHope it helps!
Regards.
@hwk-fr thanks for backing up.
@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.
- The topic ‘Support for ACF (Advanced Custom Fields)’ is closed to new replies.