# No sort dialog when making page visible?

**URL:** <https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246>\
**Category:** Questions\
**Tags:** v2\
**Created:** [August 14, 2017, 12:16am UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246 "2017-08-14T00:16:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [August 14, 2017, 12:16am UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/1 "2017-08-14T00:16:42Z")

</div>

When a page is created it is invisible. When I make it visible, a sort dialog is created. Is it possible for the page to be made visible and sorted last by default without opening the dialog?

thanks

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 14, 2017, 5:36am UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/2 "2017-08-14T05:36:30Z")

</div>

No, there is no option for that.

Options:

- modify the core (`/panel/app/forms/pages/toggle.php`)
- use a publish checkbox/toggle together with a `panel.page.update` hook and optionally hide the status toggle in the sidebar. So when a user checks the publish option (and updates the page), the hook is triggered and the page sorted. (Keep in mind that if you hide the status toggle you won’t be able to sort pages manually anymore)

---

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [August 19, 2017, 11:05am UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/3 "2017-08-19T11:05:38Z")

</div>

In some installations of kirby the dialog that appears is just an OK for making the page visible. May it be related to the sorting options of subpages?

Also, just to get it clear, is there any way to prevent sorting of subpages at all ?

Thank you

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 19, 2017, 11:38am UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/4 "2017-08-19T11:38:48Z")

</div>

> [@plagasul](#):
>
> In some installations of kirby the dialog that appears is just an OK for making the page visible. May it be related to the sorting options of subpages?

Yes; if you sort by date or title (or any other field), it doesn’t make sense to have a dialog to select a sorting number.

> [@plagasul](#):
>
> is there any way to prevent sorting of subpages at all

You mean, prevent making pages visible?

---

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [August 20, 2017, 10:59am UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/5 "2017-08-20T10:59:18Z")

</div>

> [@texnixe](#):
>
> You mean, prevent making pages visible?

¡Ja! no, just preventing manual sorting.

After some time fiddling with this, I understand it better. Although I’d say that num/sort/visibility combinations may be a bit confusing for newcomers like me.

In example you can do

```
 num: zero
 sort: flip

```

…but not

```
 num: zero 
 sort: desc

```

Sorting sorts, but numbering names and sorts. Also you can:

```
num: date 
sort: flip

```

…and

```
sort: date asc/desc

```

Not saying it does not make sense, but imho the functionalities of num and sort overlap in a manner that can be confusing.

Again in my subjective oppinion I’d expect naming/numbering to _just_ name and sorting to sort.

Thank you very much.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 20, 2017, 11:11am UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/6 "2017-08-20T11:11:38Z")

</div>

No, sorting and visibility are closely related. With default sorting enabled, I don’t think there is a way to prevent manual sorting of pages, I’m afraid.

You could disable the visibility toggle completely and use a field to determine sort order, for example using the AutoID plugin or a simple hook. Then in your template, instead of using the folder sort order for sorting, use this field (you can also then use this field to sort by in the Panel).

---

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [August 20, 2017, 5:50pm UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/7 "2017-08-20T17:50:13Z")

</div>

Related question.

The Autopublish plugin uses a simple hook to sort a newly created page ‘last’ in a manner similar to this:

```
kirby()->hook('panel.page.create', function($page) {
	if ( $page->intendedTemplate == 'exhibitor-item' ):
		$page->sort('last');
	endif;
});

```

This code , as a hook under config, does not seem to work for me.

I was wondering if maybe the culprit could be the (‘last’) bit, which I cannot find anywhere in docs or forum.

Can you actually do? :

```
$page->sort('last');

```

Thank you.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 20, 2017, 6:00pm UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/8 "2017-08-20T18:00:43Z")

</div>

I think so, at least the AutoID plugin works. There’s a pair of parens missing in your code after `intendedTemplate`, though.

---

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [August 20, 2017, 6:53pm UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/9 "2017-08-20T18:53:01Z")

</div>

aw… that was it, sorry

But… is ‘last’ documented anywhere? I tried and could not find, certainly not under [$page-\>sort()](https://getkirby.com/docs/cheatsheet/page/sort) where it says the value needs to be numeric.

Thank you

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 20, 2017, 8:15pm UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/10 "2017-08-20T20:15:17Z")

</div>

The `last` parameter is not documented because the sort function here is called in a Panel context; you can’t use these special keywords (last, first) in a template/controller etc. (see `/panel/app/src/panel/models/page/sorter.php`). Or if you do, you end up with a literal “last” as the sorting number.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:32pm UTC](https://forum.getkirby.com/t/no-sort-dialog-when-making-page-visible/8246/11 "2025-02-06T17:32:19Z")

</div>


