Sommerregen / grav-plugin-themer

This plugin enables you use different themes on one site individual set per page or collection.
Other
18 stars 1 forks source link

Twig_Error_Runtime - Error #4

Closed konstantingoretzki closed 7 years ago

konstantingoretzki commented 8 years ago

I get the follwing error message, if I activate the plugin under Grav v1.1.5 inside my Admin Plugin and go to /admin/pages (Admin v1.2.2).

Twig_Error_Runtime An exception has been thrown during the rendering of a template ("FilesystemIterator::__construct(/home/my-user-name/www/grav/user/themes/multiverse/templates/modular): failed to open dir: No such file or directory") in "pages.html.twig" at line 124.

Sommerregen commented 7 years ago

@terriblespider This looks like a generic error. Not related to this plugin here. Does your site work, when themer is disabled? Can you check whether commenting themer.php#L67 helps? That's the only code of piece, I can image, which may cause the error...

konstantingoretzki commented 7 years ago

Commenting out L67 worked ;) Thanks a lot :)

Sommerregen commented 7 years ago

Hi @terriblespider ,

commenting out L67 was only a test to see what is going to happen behind the scenes. This plugin requires the method in order to show you in the admin the available page types.

After all I tracked down the error and as it turns out is an upstream issue of Grav core. Can you open an issue there?

The reason why you see this error enabling themer is, that you are using a custom theme multiverse, which doesn't have a folder modular in user/themes/multiverse/templates (as the error suggests). Grav core seems not to handle the case, where this folder is missing. It silently assumes, that the folder exists... (see Types.php#L84-L85 ). You may add a folder there and the error should go away, too.

I will keep this issue open for reference.

Sommerregen commented 7 years ago

Bug is reported and PR is provided. Will be fixed in Grav Core soon!

Will close this issue. Feel free to open it, when the issue still persists.