WAIT: I'm not 100% sure this is a bug... but... ACF file field always returns URL

I have a Query with ACF repeater. Field A or B will be blank - and i need the ‘not blank’ one. So I do this:

The function ds_acf checks which is blank and returns the other. It works fine with text fields and URLs… but item_doc is a file - and as soon as I use this field type the {echo:ds_acf…} breaks - it shows “{echo:ds_acf…}” on the front end - not the result, but the actual code.

My guess is, the field contains characters that break the syntax of the {echo:}.
To fix this I thought I could have ACF return the file ID - and use my function to format it properly. But it makes no difference. It still returns URL.

I notice in a test that ‘return file id’ if used on it’s own with Bricks Query, still returns the file URL. So my question / bug is… does Bricks force the FILE field to return URL - does it do some formatting of its own? In which case, how do I just get the file ID?

Bit complicated but I hope it makes sense.

Hi Mike,
Thanks so much for your report!

Is the site accessible? If so, would you be so kind as to send temporary login credentials and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase?

That’s probably faster and more accurate than rebuilding the whole setup :nerd_face:

Best regards,

@digismith, @timmse: I think this is a limitation of Bricks ACF integration in terms of ACF file / link / post fields. I already created a feature / improvement request:

ACF Link Field enhancements.

It’s a local dev site. But @aslotta is correct, the issue is actually much simpler - in that Bricks always returns URL for file, regardless of ACF settings.
I will push it to a temp URL. I’ve fixed it now by doing all the get_fields in my function instead - But I’ll revert to the broken code on the temp site.
Thanks for your rapid response :slight_smile:

Hey guys,
Have you tried the :url parameter?

To confirm… if I use JUST THE FILE - it all works fine. Returns LINK or URL with filter.
JUST THE VIDEO - is fine.
If I use two text fields to a function - {echo:function({‘acf_one’},{‘acf_two’}) it works fine.
If I send FILE or URL fields to the function it breaks. Testing now I see it breaks with web URL too - so it’s not just the FILE field. None of the filters helps (:raw, :url, :link)
So it’s not coping with URLs. I will send a link to the site - but it’s huge and will take me a while to upload the backup. However, I suspect it’s easy to test. Create a function and try sending a URL or FILE ACF field to it.

My original enhancement request actually was about the link field (to get the title, url and target) subfields. I just expanded it to the file and post fields in this thread without taking a deeper look. Sorry for that. :sweat_smile:

1 Like