In a grav theme plugin, I want to provide a method to fill a select input field in a page blueprint with some other page's routes:
video_route:
type: select
data-options@: '\Grav\Theme\MyTheme::videoRoutes'
Those pages must be descendants of another specific page, called 'videos', here. My theme plugin method looks like this:
public static function videoRoutes() : array
{
$pages = new Pages(Grav::instance());
$pages->init();
$collection = $pages->getCollection(['items' => ['@page.descendants' => '/videos']]);
[...]
}
Inside the Grav\Common\Page\Pages::getCollection() method, the 'videos' object is found and instanciated, and the format of the params array seems also correct. But the resulting collection is empty. What is wrong with my approach?