Fetch content from a page selected through a query

Hello,

I have a field set like this:

  movie:
    label: Movie
    type: select
    options: query
    query:
      page: movie
      fetch: children
      value: '{{uid}}'
      text: '{{title}}'
      flip: false

And in a template I would like to display some content from that selected page. All I can display is its uid, I couldn’t find the way to fetch any other field from that movie page. Is that even possible?

Thanks.

This should work:

$page->find($page->movie())->title()

Thanks but that didn’t work.

In the docs, I just found this: http://getkirby.com/docs/cheatsheet/field-methods/pages
And it’s pretty much what I wanted to do, fetch content from a “related” page, so I’ll be using that method.

You can do that, but it would not make much sense, because the pages method returns a collection that you would have to loop through to get your page.

The code I posted above should work on the assumption that you are trying to output it in the template for the parent page of the page selected in your select. What sort of error message do you get when using the code?