WAIT: ACF repeater: get_sub_field not working

Bricks Version: 1.5.6
Browser: Edge latest
OS: Windows

Inside a Bricks ACF repeater the get_sub_field function from ACF is not working.

I know that Bricks dynamic data supports subfields. However, I need it in code.
How should I get a sub field in code?

2 Likes

Can you share screenshot of your field group and/or json export?

I can confirm that there seems to be an issue. It works when using the Bricks tag. It does not work when using the get_sub_field function.

1 Like

I’ve found a workaround using the \Bricks\Query::get_loop_object().

However, I don’t think this is a good solution. I don’t want to access internals of Bricks.

2 Likes

Agree, very annoying…
Fix is needed ASAP, please.

Hey Tobias,
Sorry for the late reply!

If I understand the ACF docs and the report correctly, get_sub_field() only works inside the have_rows() function, which loops over the repeater rows. Otherwise, the entries are not available.

The same applies without the code element: you need an ACF repeater query loop (which acts as “have_rows()”) to make the entries available.

Best regards,
timmse

1 Like