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