Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Page count adding modules

Started by Muut Archive 10 years ago · 5 replies · 414 views
10 years ago

Maybe it's me, but ran into an admin problem. We made modules hoping to allow the client to create pages after we hand off. But the modules are adding on the page count. Did we set up something wrong? Is there a way that all the modules will call under one page and just make "1" for the page count? Unspecified

10 years ago

A modular sub page is in fact still just a page to Grav, hence why they are in the page count. When we refactor how modular pages are built and hide their pageyness from the user, we'll probably remove them from counting towards the overall page count, but it doesn't make sense to do that now.

10 years ago

Of course this is just a temporary solution (any update to Grav core will overwrite it), but you can always change the file user/plugins/admin/classes/admin.php and find:

PHP
public function pagesCount()
    {
        if (!$this->pages_count) {
            $this->pages_count = count($this->grav['pages']->all());
        }
        return $this->pages_count;
    }

and replace it with

PHP
public function pagesCount()
    {
        if (!$this->pages_count) {
            $path = $this->grav['pages']->root()->path();
            $this->pages_count = count($this->grav['pages']->children($path));
        }
        return $this->pages_count;
    } 

@rhukster : I don't see this change impacting other areas, does it? It would be much more intuitive from a user perspective for the badge to count only non-modular pages.

10 years ago

Because modular pages are currently 'displayed' as regular 'nested' pages, i think it would be weird to change how the page count is rendered now.

10 years ago

From a user perspective (not from admin or developer) it is weird to count nested pages as regular pages. I would really like to propose this change as it reduces confusion for a regular user.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1369 9 years ago
Archive · by Muut Archive, 9 years ago
2 942 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1125 9 years ago