Select Field: Dynamic Options from Page Model Method

Is there anybody out there with an example of a page model method that returns valid options for the select field (

$result = array();
// implement me...
array_push($result, ['value' => 0, 'text' => 'Nothing found']);
return $result;

This implementation yields the following error:

get_class() expects parameter 1 to be object, array given


You need a flat array of key/value pairs:


class AlbumPage extends Page
    public function cover()
        return $this->content()->get('cover')->toFile() ?? $this->image();
    public function options() {
        return ['single' => 'Single', 'repeat' => 'Repeat'];

In blueprint:

    type: select
    options: query
    query: page.options

Your array, however, returns an array of arrays

    [0] => Array
            [value] => 0
            [text] => Nothing found


Thank you very much. I was looking way to far :upside_down_face:

Although, this looks correctly in the panel, it seems not to work as expected.

The options from you example translate in this JSON payload:

As you can see, textand value is identical.

That was finally the reason why I was experimenting with other constructs such as my proposed array and with Collection or Structure objects.

Hm :thinking: