At first I would create a custom page method festivalYear() for the children of the press page.
// site/models/article.php – assuming the page type is "article"
class ArticlePage extends Page {
public function festivalYear() {
return $this->festival()->toPage()->date()->toDate('Y');
}
}
Afterwards you should be able to sort and group by this custom method like this:
@texnixe also one more question, can’t figure out how to pass the value of child pages radio field to $callback
A bit more details about the case:
There are festivals, each festival has performers as child pages. Each performer has category as radio value. So on festival page I need to show performers, grouped by their categories.
I this case it probably makes sense to set up a category map (i.e. array of key/ value pairs) in your config file or, since you seem to have a multilanguage site, in your translation files, otherwise you would have to get the blueprint of one specific page and get the text that matches the current value from that page’s blueprint.