Blueprint fields as options in a select field

Hi,

We need to work with the fields of the blueprint.
Frontend is no problem with PHP, but the same query in a select field does not work…

Frontend query looks like this:

<?php $fields = $pages->find('projekte')->children()->first()->blueprint()->fields(); ?>

In the blueprint file like this:

type: select
options: query
query: pages.find('projekte').children.first.blueprint.fields

But this leads to erros.

Access to non-existing property pages on array

Is this not something we can do?

Let me know!
Thanks

You can use site.find('projekte') instead.

full query is now

site.find('projekte').children.first.blueprint.fields

Which leads to this error:

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

is there another way to query the blueprint fields of a specific blueprint?

The problem is that fields returns a nested array. So you better create a custom method that returns an array of values you want to select from here.

Where would I do this, so I can use it in a query?

You can use a custom page method or a method in a page model.

1 Like