Draggable snippets/modules


I have a set of snippets that are loaded if the user clicks on a checkbox. For example:

<?php if($page->main_toggle_references()->bool()) snippet('snippet-references-slideshow') ?>
<?php if($page->main_toggle_clients()->bool()) snippet('snippet-clients') ?>
<?php if($page->main_toggle_cta()->bool()) snippet('snippet-cta') ?>

Now, since these are “hard coded” in the template, the user is not able to move snippet-cta to the top. It’s position is defined by how they are set in the template file, the user is only able to activate them or not.

What would be a way to allow users to position snippets as they want? Like a structure field where the user can drag and drop the position of the snippet. Thanks!

The relationship plugin could be a fitting option: https://github.com/olach/kirby-relationship. If you add the three snippet names as options, the user can both select which ones to use and sort them at the same time.

1 Like

Thanks! Trying it now.