Jump to content

Selector 'where all repeater items'


Pete Jones
 Share

Recommended Posts

In reference to http://processwire.com/api/fieldtypes/repeaters/ is it possible to say 'where all repeater items' rather than 'where at least one repeater item' inside your selector?

What I have is a repeater with a checkbox. I want to find pages where all repeater items on the page are checked or unchecked. If I do this:

$pages->find("my_repeater.my_checkbox>1");

I get pages where at least one repeater item has the checkbox ticked, but what I want is pages where the checkbox is ticked in all of the repeaters.

Link to comment
Share on other sites

1 hour ago, LostKobrakai said:

$pages->find("!my_repeater.my_checkbox<1");

This should work. It means find all pages where NOT at least one repeater does have an unchecked checkbox.

And you'll probably want to add something to make sure you only match pages containing my_repeater:

$pages->find("my_repeater.count>0, !my_repeater.my_checkbox<1");

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...