Panel section query

I have a collection page, where you can create artwork (collection item).
Every artwork is linked to an artist.
Could I list all the artworks on page “Collection” (kirby panel), grouped by artist?
I can already sort by “artist asc”, but I would love this instead:

  • show the artist name “christel” (instead of “Published”)
  • list her artworks below
  • show artist name 2 “…”
  • list his artworks below

Can I accomplish this?
How can I loop like this inside a blueprint?

I think this can be accomplished, but not out of the box. You would need a custom section that would then consist of subsections.

Since you don’t know the number of artists in advance, setting them up as separate sections in the blueprint doesn’t make sense.

Hmm. Could I maybe look at it from a different angle?
Every artist has an artistpage, could I fetch his/her artwork items there?
How so?

Yes, that would be possible. Again, not with a standard pages section because they don’t allow filtering, but should work with this plugin: https://github.com/rasteiner/k3-pagesdisplay-section.

Thanks, this was helpful, I’m not 100% there yet though…
How can I add dynamic parameters into my blueprint?
“steve” should be replaced by the GET ‘artiesten’ from the url…


That’s not possible, but could be solved with a Page method, see this example: Querying information to display

@texnixe What am I doing wrong here?

As I said above, you can’t use variables inside the filterBy() method, you would have to create a page model

But how do I apply the page model inside my blueprint? Could you steer me in the right direction?

query: page.getCollection()

Then in your model

public function getCollection() {
  return $pages.index.filterby('artist', $this->title()); // or wherever the artist is stored
}

Please post code as code snippets in the future, never as images.

This gives me an error:
Use of undefined constant pages - assumed ‘pages’ (this will throw an Error in a future version of PHP)

Sorry, copied your blueprint code without adding the $, should be $pages of course. Maybe that variable is not even available in the model, then use

$this->site()->index()...