Simple Testimonials filter by custom attribute
Permalink
Anyone know how to filter the simple testimonials block by a custom attribute?
I want to show a different list of testimonials on different pages.
The testimonials have a unique reference/subject field (string) and in the block I would like to set that reference so only those testimonials are shown.
I want to show a different list of testimonials on different pages.
The testimonials have a unique reference/subject field (string) and in the block I would like to set that reference so only those testimonials are shown.
public function view() { $testimonialLimit = $this->limitQty; $testimonialPageLimit = $this->pageQty; $testimonialList = new TestimonialList(); if ($testimonialPageLimit && !$testimonialLimit) { $testimonialList->setItemsPerPage($testimonialPageLimit); $factory = new PaginationFactory(\Request::getInstance()); $paginator = $factory->createPaginationObject($testimonialList); $pagination = $paginator->renderDefaultView(); $this->set('testimonialslist', $paginator->getCurrentPageResults()); $this->set('pagination', $pagination); $this->set('paginator', $paginator); }else{
Viewing 15 lines of 20 lines. View entire code block.
Any insight on how to do this?
filter is available on all item lists in the core. It accepts 3 arguments column name, value and comparison (default is =)
Thanks @deek87
$testimonialList->filter('field',$uniqueID);
$testimonialList->filter('e.Testimonial','012019'); $testimonialList = $testimonialList->getResults();
Thanks @deek87