Open calebgrove opened 7 years ago
What about using the query
keyword, like Kirby's native select
field does?
To select from a page URI:
structurepage: page-slug
To select form a dynamic page:
structurepage: query
query: parent
@samnabi Love it, that's probably the best (and most Kirby-like) approach. Now, to find the time to build it...
I'm not sure what other query
options would make sense here, without getting into full-fledged PHP filtering functions.
grandparent
is too ambiguous (which grandparent?)
sibling
is too ambiguous, but nextSibling
and previousSibling
might work
same for firstChild
or lastChild
Just some ideas for your consideration.
As it currently stands,
structurepage
in the blueprint is set to a string version of the page URI. This is nice and simple, but is very inflexible as it is always tied to one exact page.Instead, you should be able to use good a 'ol Kirby page selection logic that returns a page object. For example, you could use
structurepage: $page->parent()
to select the parent of whatever the current page is. This would allow for usage in larger, more complicated websites where a blueprint may be used in many different contexts.This only issue here is that backwards compatibility would be broken unless we use a new key (
structurepage
would continue to work as it does,page
[for example] would be the newer implementation).