SOLVED: ACF dynamic data always returns label even when value is selected in ACF field settings

Bricks Version: in stable 1.4.0.2 also in beta 1.5
Browser: Shouldn’t matter
OS: Shouldn’t matter

When using ACF fields dynamic data for a field that supports “value : label” choices the output is always the label even when “Return Format” is set to “Value”.

This happens for all the choice fields:

  • Select
  • Checkbox
  • Radio button
  • Button group

This happens for both:

  • single page specific fields
  • fields of items returned in query loop

This happens no matter what is set in the “Return Format” setting.

It ISN’T a problem with ACF itself as get_field() works fine for these fields.

So it seems like this is a global bug in the Bricks.

Possible solutions:

  1. Add filters that work with ACF, like :value, :label, :array.
  2. Make Bricks respect the ACF field “Return Format” setting. (Better choice if you ask me)
1 Like

Hello @Matiasko

This will be fixed in the coming Bricks release.

Bricks was always returning the choice label, but we agree that if the user selects to return the value in the ACF field configuration, then Bricks should retrieve the value and not the label. For the option “both (array)” Bricks will continue to return the label.

Thank you for your report.
Luis

2 Likes

What about the possibility to show any other field from the post_object or if I choose to return post_id / term_id (in case of picking taxonomy in ACF) it always return label of the picked item?

For example:

I have customPostType where I want to put slider with related WooCommerce product related by productCategoryID (term_id) is it possible?

Hello Jacob,

What is the exact scenario? Which field do you want to use, with which configuration, and what is the result you are getting?

Is it on the list to allow returning the value when ACF Field is set to return “Both (Array)”?

It makes no sense to not allow returning the value using “:value” when using “Both (Array)” considering using Both is a necessity in many situations as is the need to return the value when using both.

Hi Travis,
Welcome to the forum!

No, that is not planned so far. However, if we receive more requests about it, we will certainly take up the topic again. However, you could write your own little helper function that returns the array and output the values using {echo:yourFunction}.

Best regards,
timmse

1 Like

I want to say it’s not ideal, and technically it’s not, but this is such an easy solution. I continue to be impressed by the dynamic functionality of Bricks :slight_smile:

2 Likes