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!