Blueprint to create select from Page Collection

How do I get a list of child pages of /teams to create an admin blueprint for a user to create an event? (pick Home team and Visiting team for a game)

I can create a ‘select’ with options

  type: select
  label: Visiting Team
    option1: "Team 1"
    option2: "Team 2"

I want the options to be populated from all child pages that exist under /teams.

  type: select
  label: Home Team
    - ''

I can populate options from:

  data-options@: '\Grav\Common\Page\Pages::types'

I cannot populate options from:

  data-options@: ['\Grav\Common\Page\Pages::children', '/teams']
  data-options@: ['\Grav\Common\Page\Pages::getCollection', '/teams']
    '@page.children': '/teams'

I know the field works as I’ve set it up. I just can’t seem to figure out the YAML syntax for ‘get all children of /teams and populate them in a select list.’

@storm, The function being called must be a static function. The ones that are failing aren’t.


  • $ bin/gpm install devtools
  • $ bin/plugin devtools new-plugin
    Follow wizard and run $ composer update in folder of new plugin.
    Let’s say you called the plugin “teams”.
  • Add the following function to file /user/plugins/teams/teams.php:
    public static function teams(): array
      /** @var Grav */
      $grav = Grav::instance();
      /** @var Page */
      $teamsPage = $grav['pages']->find('/teams');
      $children = [];
      foreach ($teamsPage->children() as $team) {
        $children[] = $team->title();
      return $children;
  • In your blueprint use
    data-options@: '\Grav\Plugin\TeamsPlugin::teams'
1 Like

@pamtbaau’s reply is correct.

Wish I’d known Discourse is still active a few days ago when I wasted a lot of time looking for this same problem’s answer and posted a question on a closed issue before finding an answer on Stack Overflow of all places. Is this forum indexed by search engines?

$grav['admin']->enablePages(); seems to be the magic key here. I would love to see this documented as an official solution in the Collections chapter of Learn, but don’t feel qualified to volunteer as I don’t understand it properly. It seems to me it’s a reasonably common requirement.


Wish I’d known Discourse is still active

Out of sight, out of mind… :wink:

Is this forum indexed by search engines?

Yes, contrary to Discord, Discourse is being indexed by Google. Try hughbris on Google.

Maybe my problem is that I never search with Google :confused: My wondering was only based on this post not coming up near the top when I looked for it. Did not investigate further, thanks anyway!