agentejo / cockpit

Add content management functionality to any site - plug & play / headless / api-first CMS
http://getcockpit.com
MIT License
5.4k stars 525 forks source link

default query parameters #807

Open michabbb opened 6 years ago

michabbb commented 6 years ago

whenever a collection list view is done, the url shows me:

q={"page":1,"filter":null,"sort":{"_created":-1},"limit":20}

is there a chance to change these 'default' values by collection ?

thanks!

michabbb commented 6 years ago

i guess this is super ugly but i don´t know howto make this working in an addon:

at the permission-read of my collection i have:

$context->options['default_sort_by']['done']=1;

at modules/Collections/Controller/Admin.php i added (line ~140):

$collection['options'] = $context->options;

and finally do some changes at modules/Collections/views/partials/entries.php

here here here

i really would be happy to see a little howto of this that shows me, how i can do this in a clean way by creating a real addon.

thanks