Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Grav\Common\Page\Pages getlist() returns empty array

admin form

Solved by arman View solution

Started by arman 5 years ago · 1 replies · 1048 views
5 years ago

Hi !
In the blueprint of one of my pages I use this extended blueprint form :

data-options@: '\Grav\Theme\MyTheme::Myfonction'

In MyTheme.php, I try to display an array of all the pages in the website with this line:
Grav::instance()["pages"]->getList()

Unfortunately it returns an empty array. I tried to implement this code on another one of my websites and its works like a charm.

So I looked at my folder permission, I used the "permission-fix" script provided in the documentation.
I found the function getList in system/src/Grav/Common/Page/Pages.php line 1156, but I found no clues.

Does anyone know why it will display a list of pages on one website but not the other ? And what can I do to fix this problem or at least retrieve some log/info.

cheers,

5 years ago Solution

I found the solution :

/forum/plugins/page-collection-is-empty-when-in-admin-panel-t5303

To adapt it in Theme.php I did :

Grav::instance()['admin']->enablePages();

🙂

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Anna, 2 days ago
2 53 16 hours ago
Forms & Blueprints · by Anna, 3 days ago
7 82 16 hours ago
Forms & Blueprints · by Anna, 1 week ago
5 186 6 days ago
Forms & Blueprints · by TomW, 1 month ago
3 379 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 595 2 months ago