Hey all,
I have this code here:
page('testimonials')->contentTestimonials()->toStructure()->shuffle()->first();
However using shuffle()
doesn’t appear to work.
Any ideas?
Hey all,
I have this code here:
page('testimonials')->contentTestimonials()->toStructure()->shuffle()->first();
However using shuffle()
doesn’t appear to work.
Any ideas?
Shuffle does not work with a structure collection, you would have to use yaml()
and then shuffle the resulting array. See this post: Pluck structured data?
And here’s the issue on GitHub.
Shuffling structure collections will finally work in Kirby 2.3.1.