Skip to content

ProcessPageList: number of children does not account for listable #649

@Toutouwai

Description

@Toutouwai

Short description of the issue

In ProcessPageList the number of children under each parent page is indicated by a number next to the page title. However, this number does not take account of the $page->listable boolean which determines which child pages will in fact be listed under that parent.

So for example, the core Page::listable method says that a page is not listable if it isn't editable by the current user and the page is unpublished:
https://github.com/processwire/processwire/blob/c01289edb7ad650bb635e412b490e8db8fe91989/wire/modules/PagePermissions.module#L626

But because this isn't taken into account by ProcessPageList the wrong number of children can be indicated, which is confusing for the user.

Superuser:
2018-07-29_120323

Non-superuser:
2018-07-29_120414

Interestingly it is not just the two unpublished pages that result in the incorrect child count, meaning the 404 page, Admin page or Trash page must also be incorrectly included in the child count of Home, so that count will be wrong for non-superusers even on a brand new PW installation with the Blank profile.

This issue also creates a problem for anyone hooking Page::listable to set a custom listable value, which is something I do regularly. I previously raised this as part of a feature request, but now I see that an issue occurs even without custom listable values I'd consider this a bug.

Setup/Environment

  • ProcessWire version: 3.0.108

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions