NO BUG: Bricks Dynamic ACF File Field returning link not URL

Browser: Chrome 110
OS: macOS
Tested in PHP 7.4 & 8.1

I have an ACF field of type ‘File’. I have set the Return Value to ‘URL’.

In Bricks I have created a basic text field and dynamically chosen the field. But it outputs an ‘a href’ not the image URL.

Whether I set it to ‘File Array’, ‘File URL’, ‘File ID’ it always outputs a full link with the filename, not simply the file URL:
<a href="http://localhost:10043/wp-content/uploads/2023/03/Jan-main-menu-04.01.2022-1.pdf" aria-label="Download Jan main menu 04.01.2022">Jan main menu 04.01.2022</a>

It works as expected if I use the ACF shortcode ie: [acf field=“test_pdf”] However, this workaround does not help me as I want to use this in a Repeater field (ACF do not offer shortcodes for repeater)

You’re looking for the :url filter.

{acf_test_pdf:url}

See the bottom of the docs, for the filters - Dynamic Data – Bricks Academy

3 Likes

Hi Simon,

As per the explanation by David, please use :url filter.

Regards,
Jenn

Thanks very much, I had not realised. I had spent so long searching.

Just so I understand: so, there’s no ‘control’ in the Bricks sidebar to add the filter for ‘:url’, we just need to know and type it in?

I would just feedback that it seems a little unintuitive to not return the ‘Return Value’ specified in ACF when using the default dynamic tag inserted by Bricks.

I’m very grateful for the help. If I could, I would now change the category of this post to ‘How To’.

I agree with the need for some indication that filters for controlling the behavior of the output are available. If not a conditional menu, then a link or other notation such as “See Dynamic Data Filters” and that information now found at the bottom of this page: Dynamic Data – Bricks Academy could be on it’s own page: https://academy.bricksbuilder.io/article/dynamic-data-filters-all. Like this, maybe?

I was trying to sort out why an attribute (download / dynamic filed) was working fine for a MB Single Image field but not for the same setup on a MB File Input.

The {mb_singel_image_field} when used for the value of attribute “download” produces a link that downloads with the correct image file name (e.g., “my_imagefilename.png”).

The {mb_file_input_field} produces a link (for a PDF download) that downloads the filename as file path of sorts (e.g., “a href= https __mywebsite.com_wp-content_uploads_2024_04_complete-filename.pdf”) in Firefox. On Chrome it’s even more verbose (e.g., “_a href=https___mywebsite.com_wp-content_uploads_2024_04_complete-filename.pdf aria-label=Download complete-filename__complete-filename__a”).

Using {mb_file_input_field:plain} strips off the filepath info and delivers the download with the plain filename.

1 Like