craft-snippets / craft-named-routes

This plugin allows you to get a URL of routes set in config/routes.php from within Twig templates - you will no longer need to hardcode them in your markup.
MIT License
7 stars 1 forks source link

Error on CP -> settings -> route. #3

Open GMConsultant opened 5 months ago

GMConsultant commented 5 months ago

Hi there, thank you for writing this plugin that works perfectly in the front end. The problem occurs if I try to configure a new route in the control panel and this is the error that appears:


Twig\Error\RuntimeError: Neither the property "getProjectConfigRoutes" nor one of the methods "getProjectConfigRoutes()", "getgetProjectConfigRoutes()"/"isgetProjectConfigRoutes()"/"hasgetProjectConfigRoutes()" or "__call()" exist and have public access in class "craftsnippets\craftnamedroutes\variables\CraftNamedRoutesVariable". in /home/mydomain/craft/vendor/craftcms/cms/src/templates/settings/routes.twig:33
Stack trace:
#0 /home/mydomain/craft/vendor/craftcms/cms/src/helpers/Template.php(129): twig_get_attribute()
#1 /home/mydomain/craft/storage/runtime/compiled_templates/7c/7ced1ab61802cf4d4c2a526dfdd5ec07.php(54): craft\helpers\Template::attribute()
#2 /home/mydomain/craft/vendor/twig/twig/src/Template.php(394): __TwigTemplate_0325ca502202c1c4b40f6c7d5e42ee6e->doDisplay()
#3 /home/mydomain/craft/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#4 /home/mydomain/craft/vendor/twig/twig/src/Template.php(379): Twig\Template->display()
#5 /home/mydomain/craft/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render()
#6 /home/mydomain/craft/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render()
#7 /home/mydomain/craft/vendor/craftcms/cms/src/web/View.php(482): Twig\Environment->render()
#8 /home/mydomain/craft/vendor/craftcms/cms/src/web/View.php(535): craft\web\View->renderTemplate()
#9 /home/mydomain/craft/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\web\View->renderPageTemplate()
#10 /home/mydomain/craft/vendor/yiisoft/yii2/web/Response.php(1100): craft\web\TemplateResponseFormatter->format()
#11 /home/mydomain/craft/vendor/craftcms/cms/src/web/Response.php(337): yii\web\Response->prepare()
#12 /home/mydomain/craft/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()
#13 /home/mydomain/craft/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#14 /home/mydomain/craft/web_cp/index.php(12): yii\base\Application->run()
#15 {main}

Obviously if I disable it the error disappears and I can access to the routes configuration.

Server configuration:

piotrpog commented 5 months ago

Thanks for pointing this out. Will take care of it soon.