Jump to content

Selector for repeater rows type


a-ok
 Share

Recommended Posts

I'm looking to return repeater matrix rows (pages) where the type is equal to testimonial

$testimonials = $event->pages->find("template=repeater_modules, modules.type=testimonial, include=all");

This seems to return all repeater pages and simply ignores the `modules.type=testimonial` selector. Have I got this wrong?

If I barDump out `$testimonials->explode('type')`, one of the entries returned is "testimonial" so I'm a bit confused.

Link to comment
Share on other sites

I ended up just doing

foreach ($testimonials as $t) {
	if ($t->type == "testimonial") {
		$t->title = $t->getForPage()->title . ' — ' . $event->sanitizer->truncate($t->global_textarea, 40);
		$testimonialsNew->add($t);
	}
}

Which seemed to work fine but I would've though I could've queried by the repeater matrix type within the selector... but maybe not?

Link to comment
Share on other sites

  • 2 months later...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...