Ok, so Iâve had some success with the methods posted so far, but hit a bit of a roadblock.
Iâve set up a series of pages with a ânetworkâ template, and each of these has subpages with a âpageâ template.
So I have a structure like:
Europe (network)
- About (page)
- Contact (page)
- âŚ
US West (network)
- About (page)
- Contact (page)
- âŚ
âŚetc
I have successfully setup a Network Editor role, and within the fields for that role I have allowed for the selection of the âNetworkâ this user is responsible for editing using a select field with options of the root network pages.
Using the below snippet, I can use a differnet blueprints folder when a network editor logs in
if( $current_user && $current_user->role()->name() == 'network_editor') {
$kirby = new Kirby([
'roots' => [
'blueprints' => __DIR__ . '/site/blueprints/_network',
],
]);
}
When they log in, I need them to see a list of the child pages in their network. I can achieve this in a hardcoded fashion e.g for âus-westâ:
tabs:
pages:
headline: Pages
sections:
drafts:
headline: Drafts
type: pages
parent: site.find("us-west")
status: draft
layout: list
templates:
- page
empty: No pages yet
However I need that âus-westâ value to be dynamic and pull from the current users ânetworkâ field value.
Is this possible in any way?
Iâve looked at the âpagesdisplay-sectionâ plugin which allows me to use a query, but I still canât see how it can be dynamic?
Iâm assuming itâs canât be as this is a yml file - but is there any way the âparentâ or âqueryâ keys can reference a php function?
I really donât want this hardcoded, as I have 11 (and increasing) networks, for which the config will be identical so I want it to stay DRY.
Can the blueprints inherit in any way? So I can have a base blueprint config, but then have a blueprint per network that sets the correct network?
Sorry for the super long post. Iâm enjoying my experience with Kirby so far, and am quite keen to use it for my project if I can make it work, but I appreciate itâs a fairly bespoke setup.
Any help or pointers gratefully recieved!