jon9china Posted February 17, 2020 Posted February 17, 2020 I want to return a repeater object in my pages by matching the value of a field within the repeater. In docs, it says repeater can be treated like a page, but what does that mean for this sort of case? for example, my repeater might be named: 'word_object', which includes fields 'this_word', 'definition', etc. and i want to return a word_object where the field 'this_word' == 'apple'
gebeer Posted February 18, 2020 Posted February 18, 2020 To find all pages where the repeater field word_object has a field this_word with value apple you can use subfield selectors $pageArray = $pages->find("word_object.this_word=apple") This will return a PageArray with all those pages. Now to get all the word_object repeater fields from this PageArray, you can use the WireArray explode method $repeatersArray = $pageArray->explode("word_object") This will return an array with all the repeater fields. You can now foreach through this array and output whatever you need. You could also chain this to a single operation $repeatersArray = $pages->find("word_object.this_word=apple")->explode("word_object") 5
jon9china Posted February 18, 2020 Author Posted February 18, 2020 Thanks! ! This is right on. WIll try it today.?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now