pmoreno-rodriguez / grav-theme-mundana

Mundana Jekyll theme ported to Grav
MIT License
7 stars 2 forks source link

ValueError array_rand(): Argument #1 ($array) cannot be empty #9

Closed ventoux84 closed 5 months ago

ventoux84 commented 5 months ago

After update theme to 1.2.0 i get this error

ValueError
array_rand(): Argument #1 ($array) cannot be empty

from line 204 in /var/www/html/system/src/Grav/Common/Iterator.php $this->items = array_intersect_key($this->items, array_flip((array)array_rand($this->items, $num)));

Something is wrong on my site or in the update ?

 ValueError
…/system/src/Grav/Common/Iterator.php204
74
array_rand
…/system/src/Grav/Common/Iterator.php204
73
Grav\Common\Iterator random
…/vendor/twig/twig/src/Template.php702
72
Twig\Template getAttribute
…/index.php47
ventoux84 commented 5 months ago

I created a new page blog modular template and attached my posts to it. Now it works.

Edit : Perhaps because i attached also your blog page "Twig primer" who as a category "Tutorial".

ventoux84 commented 5 months ago

To test, I only have one of my pages on the blog. It only works if this page is assigned to the following categories: editor, grav,tutorial. If I delete one of these categories on the post, the blog displays an error page.

ventoux84 commented 5 months ago

I deleted all your pages and it works.

ventoux84 commented 5 months ago

ok