NO BUG: Conditions acf repeater "not empty" not working

Browser: Chrome 110
OS: macOS / Windows / Linux / etc.
URL: Link to a page that illustrates this issue
Video: Short screen recording that illustrates this issue (free tool: jam.dev)

Conditions “if not empty” on acf repeater is not working.

It displays the element in both cases.

Hey @salwebs,

you can use ACF’s have_rows function in combination with Bricks’ echo tag:

CleanShot 2024-10-30 at 17.13.27

Make sure to whitelist the have_rows function:

add_filter( 'bricks/code/echo_function_names', function() {
    return [
        'have_rows',
    ];
} );

Best,

André

Ok thanks, but why is not working by default?

Hey @salwebs,

I guess the is (not) empty conditions are not implemented to work with ACF repeaters. But that is something the Bricks team has to answer. :slight_smile:

By the way: If I use the dynamic data (lightning) icon in the conditions area ACF repeater fields aren’t even offered to me. So I am wondering where you got the {acf_faq} from. Did you manually insert it?

Best,

André

Hi @salwebs,

actually, I just tested it, and if I don’t have a different setup than you, it should work.

  1. I created two posts, and in one I’ve added a relationship, and to the other, I didn’t. The image below is the “Croatia”, where I didn’t add any relationship fields.

  2. Inthe builder, I have a condition like this. The other element, has a “is not empty” condition.

If I open “Croatia”, you can see that it correctly outputs the “empty” element, and below, there are no repeater elements.

"

If I check “Slovenia”, then I can see that it correctly output the “not empty” element, and below you can see two repeater fields.

Do you have a different setup?

Matej

Hey @Matej,

I think it’s about repeaters, not relationships.

Best,

André

1 Like

Ah, @aslotta, you are right. I misread and I’m sorry!

@salwebs, for now, the way @aslotta suggested is the way to go.

Best,
Matej

That’s it, I know that acf dynamic data works like this some times i add it manually.

Probably that’s why is not working. But anyway, dynamic data should be consistent. If you have dynamic data in conditions and dynamic data can use acf, it just should work.

best