Status-/visibility-Button without dialog/modal

Hi!

Is there a way to change the visibility of a page circumventing the dialog/modal (see screenshot) which is asking to change either the order OR the visibility? I’d like to try to implement a small toggle switch to JUST change the visibility (see screenshot).

Of course it’s possible to add a simple checkbox-field and ask for it’s status, but then the drag and drop-function on the subpages-page doesn’t work anymore – because it obviously changes the status but not the hypothetical checkbox-field.

(I also tried the status-plugin from @jenstornell, https://github.com/jenstornell/kirby-status)

Thanks for your advice!


11

What do you expect to happen? Make page visible and use the last sort order plus one?

I’m trying to implement a Publish/Unpublish-toggle switch instead of using the sidebar-Status-toggle switch so that the modal window isn’t being triggered. Do you think that’s possible?

Yes, you can achieve that with a custom fiield that triggers publishing of the page

I read the docs but could you nevertheless maybe point me in the right direction, scripting-wise? That would be really appreciated!
Thanks for your help!

I mean not on how to script a field in general but what commands I would need for the state-changing.

Maybe you could have a look at some example custom fields here:

Your field would have to call a route that takes on the job of making the page visible.

The method to make a page visible is $page->sort(). To get the correct number to append the page at the end, sort pages by number and then get the number of the last page with $page->num().

Thanks for your quick reply!
Can I also use the panel.page.sort hook?

Ah, sorry, I might have misunderstood the hooks. Sry.

The panel.page.sort hook only kicks after you have sorted a page via the Panel, so that doesn’t get you anywhere.

Yeah, I just realised :smiley: