Is is possible to add a new row to the top rather than the bottom of a structure field (in the panel) ?
You can auto-sort them using the
sortBy option, so depending on your sort field, that might end up with the latest addition at the top, e.g.
date desc. Other then that, I don’t see an option to add new entries to the top (apart from using a hook that flips the order on save).
ok thanks, unfortunately there is nothing like a date field i can use to sort.
I am struggling to flip the sort the order in front end too, I want to show last to first of the structure field, this does not work:
<?php foreach (page()->review()->toStructure()->sortBy('sort', 'asc') as $cat): ?> .. <?php endforeach ?>
For the frontend, you can use the
which then just flips the sort order you have saved in the field.
For reference: Here’s the issue on the GitHub Kirby Fairy list: