Skip to content
Grav 2.0 is officially stable. Read the announcement →
Forms & Blueprints

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

admin form

Solved by arman View solution

Started by arman 5 years ago · 1 replies · 833 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 Ton Haarmans, 6 years ago
13 1863 6 months ago
Forms & Blueprints · by Hugo Oliveira, 7 months ago
0 451 7 months ago
Forms & Blueprints · by Flachy Joe, 8 months ago
9 548 8 months ago
Forms & Blueprints · by Augustus, 9 months ago
7 570 9 months ago
Forms & Blueprints · by Julien, 9 months ago
10 590 9 months ago