This seems really obvious, but I cannot get it to work for me. Basically, I want the user to select a child page from the Select box in the panel, and from there, I want to use that Page to echo out the title, etc.
But I can’t get the page called in my code. ‘Home’ is the parent page, ‘category()’ is the child page name from the select dropdown in the panel.
In the first line you are fetching the homepage’s category field itself. On its own it has no relation to the page object you are trying to access (it is simply the string you entered into the field).
If the pages are placed on the top-level, you can access them using the following:
So it looks like that is still not outputting anything. I tried both versions you mentioned, just in case – and neither one seems to be converting that text from the Select field into a usable Page for the echos below it.
The rest of the page below that bit of code does not load. So it’s breaking there. And thanks for your help!
Absolutely, here you go! It’s a mostly static home page, with an intro blurb and a featured event.
title: Home
pages: false
fields:
title:
label: Title
type: text
intro:
label: Introduction
type: markdown
category:
label: Featured Event
type: select
options: query
query:
page: events
fetch: children
Like I mentioned earlier, I would like the user to select the event to be featured from a Select dropdown. I thought that as long as it was outputting the name of the event page, I could easily pull that “category” (ex. EventName) and get my event page title, date, description, etc. from there. But that has not happened.
@texnixe – That second one got it!! Thank you so much, I really appreciate it.
And reading your solution makes sense… I just couldn’t get there myself!
Having the same issue — using a select dropdown in the panel to choose from a list of venues for an event. Here’s my implementation of the suggested solution:
Just to clarify, when I add a venue from the dropdown in the Panel, only the bare page uid is returned. So for example, if the venue title was Coffee Shop, it gets saved in the markdown file as venue: coffee-shop.