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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

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 · 704 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, 5 years ago
13 1136 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 134 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 129 7 months ago