I have a set of ‘film’ pages (children of the ‘films’ page), including a multiselect field ‘prod’, which gets the team members, entered in a structure on another page (‘apropos’).
→ film.yml (site/films/film) :
title: Fiche film
(...)
prod:
label: "produit par"
type: multiselect
options:
type: query
query: site.find('apropos').equipe.toStructure
text: "{{ item.nom }}"
value: "{{ item.nom }}" // John Doe
→ film.fr.txt (site/films/film) :
Title: Alias
----
Prod: John Doe
----
For a new feature, I’ve created a page for each member of the team (site / cv / cv-prod). On each page, I want to display only the films produced by that member (i.e. when the ‘prod’ value matches the page title). This works fine when I test directly with the name : query: page.childrenAndDrafts.filterBy(‘prod’, ‘John Doe’), but not when I try to query the current page title.
→ cv-prod.yml (site/cv/cv-prod) :
title: Page producteur
columns:
- width: 3/3
sections:
filmsprod:
type: pages
label: Films produits par {{ page.title }} // Films produits par John Doe
parent: site.find("films")
query: page.childrenAndDrafts.filterBy('prod', kirby.page.title)
template: film
status: all
→ cv-prod.fr.txt (site/cv/cv-prod) :
Title: John Doe
----
Text: Test
----
Uuid: 3PsPBXuxv31S9XBY
I’ve done it without any prob on the frontend, but on the panel I can’t manage it.
→ cv-prod.php (controller) :
$filmsprod = page('films')
->children()
->listed()
->filterBy('prod', $page->title())
->sortBy('date', 'desc');
$nomprod = $page->title()->value(); // gets the current page title, which I can't do from the panel
$ficheprod = page('apropos')
->equipe()
->toStructure()
->findBy('nom', $nomprod);
Also, without adding ‘value()’ for $nomprod, I couldn’t get any data from $ficheprod.
Sorry, I’m not sure I’ve given you any useful information…