So I have a Kirby site for a client who needs to be able to customize pages with sidebar widgets.
I’ve done some hacky stuff to get by for now:
$widgets = $page->children()->visible()->filterBy('intendedTemplate', '*=', 'widget-');
foreach ($widgets as $widget):
$children = $page->children()->visible()->filterBy('intendedTemplate', '==', 'default');
foreach ($children as $child):
The problem is, to my client, this gets confusing because both widgets and child pages will show up in Kirby Panel’s left sidebar under ‘Pages’.
The most elegant solution I can think of is: what if in the Kirby Panel, when editing a page, the left side gives you the options to manage (Child) Pages, Files, and Widgets? That way it becomes very clear to the client. It’d be perfect for the client to update the content of each widget as well as rearrange their order. For my client, many times different sets of widgets are needed across the different pages.
So my question is: Does Kirby have a built-in solution for adding new things alongside Pages and Files?
Widget support would be great, but take it a step further: it’d even be better if we could add other options, such as Left Sidebar Widgets, Right Sidebar Widgets, and Footer Widgets.
No, there is no out-of-the-box solution, you would need to hack the core.
Currently, the best you can do to make it clearer for your client is probably using custom icons for pages Custom icons in the Panel although I don’t know if this has made it into the core yet (don’t think it has).
As regards different snippets in different orders, you could use a structure field and have the client select the widgets for a particular page via this field which would also make it possible to sort the entries.
It is currently in the develop branch, so if you live on the bleeding edge it’s already available It looks like it will be in Kirby 2.2.
The only option I can think of is to introduce another hierarchy level: Under the page you create two subpages
Widgets and your clients can sort their pages in the respective category.
That was what I also was thinking. As an addition to that you can use routs to change the url if you don’t like it to be like…
Maybe routed it will be…
Thanks for the suggestion. I considered doing that. It’s a little hacky and it would work perfectly fine for technical guys like us, but for non-technical people like my client, it should be more intuitive.
The Custom Icons for Pages feature that @texnixe mentioned might be a helpful workaround for now.
@bastianallgeier, I hope you consider my feature suggestion for the future!