Search
Other Articles Anywhere questions
Forum

ACF File Field Values are Now An Array - Trouble getting url of a file

Steve Babbitt's Avatar Steve Babbitt
We use Articles Anywhere and Tassos Marinos Advanced Custom fields to display a list of articles with PDF links (upload field) in a table.

I've been successfully using [file output="value"] to get a raw url for over a year now. Yay Articles Anywhere!

But it looks like Tassos has possibly updated the schema, and new uploaded files are rendering this:

[{"title":"","description":"","value":"media\/acfupload\/reference\/2019-2021_SCAP_Biosolids_Trends_Update.pdf"}]

Whereas before they rendered this:
media/acfupload/reference/2019-2021_SCAP_Biosolids_Trends_Update.pdf

So, my challenge is 1) getting the array value "value" for newer items, while 2) keeping the old value for older items.

Any suggestions?

I've tried [file output="value->value"] and [file output="value[3]"]

Any direction would be greatly appreciated.
Peter van Westen's Avatar Peter van Westen ADMIN
The raw value is in the case of that file field a json string.
There is no built-in way in Articles Anywhere to grab data from a json string.

What you can do is create a field layout that does what you want (conditionally output the rawvalue or json decode it and output the part you want).
Then tell Articles Anywhere to use that layout.

See: docs4.regularlabs.com/articlesanywhere/g...lds-layout-overrides
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription