select-a-structure icon indicating copy to clipboard operation
select-a-structure copied to clipboard

`structurepage` as `page()` object

Open calebgrove opened this issue 7 years ago • 3 comments

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).

calebgrove avatar Jun 03 '17 18:06 calebgrove

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 avatar Jun 20 '17 18:06 samnabi

@samnabi Love it, that's probably the best (and most Kirby-like) approach. Now, to find the time to build it...

calebgrove avatar Jun 21 '17 15:06 calebgrove

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.

samnabi avatar Jun 21 '17 20:06 samnabi