Sorry, we don't support your browser.  Install a modern browser

Pages section: option to hide controls

In Kirby 4.0, the pages section can now be used with a custom query, which can be used to:

  1. show a page’s children as separate lists (with different queries for filtering, e.g. show a list of drafts then a list of published pages)
  2. show pages that are not the page’s children

I’m trying to use the new query option as a replacement for the k3-pagesdisplay-section plugin. But I’m missing one of its options, controls: false, which hides the three-dots menu, and turns the section into a simple list of links to pages.

What’s the use case?

  • I have “exhibit” and “artist” pages
  • I needed to encode a “many to many” relationship between those two types. An exhibit can showcase several artists, an artist can be showcased in several exhibits.

I want to encode this relationship as a pages field in one content type, but also display that relationship as a non-editable list of pages in the other content type.

Here’s what I did:

  • Because Kirby doesn’t have classic relational database “many to many” relationships, I encoded the relationship as a pages field in the “exhibit” page. Editors can add or remove references to “artist” pages when editing an “exhibit” page.
  • When editors are editing an “artist” page, I want to list all the exhibits that this artist is referenced in, but I don’t want editors to be confused and delete an “exhibit” page from there, thinking it’s removing a relationship when it’s actually removing a page. So I want this list to just be a list of links.

The rasteiner/k3-pagesdisplay-section plugin addresses this use case well. With the new query option, the built-in pages section addresses it as well, but since it shows controls, there’s a risk of accidental deletion of content by confused editors.

It would be great if the pages section could have an option to disable showing controls. Not as a permission (editors do have the permission to delete those pages, in my use case), but as UX option (I want to nudge editors to only delete content in the place where this content exists, i.e. in the editing page for that content or for its parent; and not in other places where the content might be referenced).

Attached: screenshots of the current setup with Kirby 3 and the k3-pagesdisplay-section plugin (right-hand column), and of a tentative setup with Kirby 4 and a pages section with query option (right-hand column).

Alternative solutions:

  • Doable today: write my own custom section (or adapt the k3-pagesdisplay-section plugin for Kirby 4).
  • Alternative feature request, a bit more out there: Kirby adds a new built-in “displaylist” section type for listing stuff (pages, files, arbitrary content returned by a PHP function…) and rendering that stuff in built-in widgets (list, table, cards, cardlets). This would keep the “pages” section focused on editing.
  • Alternative feature request, very wild: Kirby adds new ways to encode “one-to-many” and “many-to-many” relationships in ways that don’t save the relationship to the content files in those relationships (in my example, it wouldn’t modify any exhibit.txt or artist.txt file), and offers dedicated relationships UI fields that can be used to edit those relationships from any of the two content types in the relationship.
2 years ago
J

I have the exact same problem with the same kind of many-to-many relationships.

5 months ago