Closed SanboKyo closed 2 years ago
Can you let me know where you receive this error? On the front-end, or in the control panel? Can you also post the full stack trace error with devMode
enabled?
It's on the frontend:
2022-05-10 05:14:18 [web.ERROR] [Twig\Error\RuntimeError] Twig\Error\RuntimeError: Calling unknown method: verbb\formie\elements\Form::getFields() in /templates/_snippets/_anfrage-formular.twig:69
Stack trace:
#0 /storage/runtime/compiled_templates/c3/c3437f40d5871f01d659d4e5d9c5209b0dc506c7a052af5344205d4e847e03d8.php(172): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(verbb\formie\elements\Form), 'getFields', Array, 'method')
#1 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_42dcc576d37f8d49339a41b880590be052f6fc8788a5707735d218685ce0be36->doDisplay(Array, Array)
#2 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#3 /vendor/twig/twig/src/TemplateWrapper.php(47): Twig\Template->display(Array, Array)
#4 /storage/runtime/compiled_templates/57/57e3365a09a5bc855c3aeb05c6dd9390cc959078bc0b027f1bf7bef24f3a3853.php(197): Twig\TemplateWrapper->display(Array)
#5 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_56c401104bdb26499fb35af1f92ff299ec91245dc437343b1af2caa801d25570->doDisplay(Array, Array)
#6 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#7 /vendor/twig/twig/src/TemplateWrapper.php(47): Twig\Template->display(Array, Array)
#8 /storage/runtime/compiled_templates/97/97a033b3ab6651d721f982286bba5e67fc6fb2a61f39d22066e59038222001de.php(61): Twig\TemplateWrapper->display(Array)
#9 /vendor/twig/twig/src/Template.php(171): __TwigTemplate_08a0348c41da25d4eee8aeefe0da810e0596142077c57569beec50e2a708a519->block_content(Array, Array)
#10 /storage/runtime/compiled_templates/64/646d9686f3e7d7ac49658522ebd88b78be490423e40294e0dbbf03ee109d8726.php(388): Twig\Template->displayBlock('content', Array, Array)
#11 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_ae85210e3b63c5374f5c481f6b5e4860f20502f8cd0258577966ec493b4e4ad5->doDisplay(Array, Array)
#12 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#13 /storage/runtime/compiled_templates/97/97a033b3ab6651d721f982286bba5e67fc6fb2a61f39d22066e59038222001de.php(43): Twig\Template->display(Array, Array)
#14 /vendor/twig/twig/src/Template.php(394): __TwigTemplate_08a0348c41da25d4eee8aeefe0da810e0596142077c57569beec50e2a708a519->doDisplay(Array, Array)
#15 /vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#16 /vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#17 /vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render(Array, Array)
#18 /vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render(Array)
#19 /vendor/craftcms/cms/src/web/View.php(414): Twig\Environment->render('index', Array)
#20 /vendor/craftcms/cms/src/web/View.php(467): craft\web\View->renderTemplate('index', Array)
#21 /vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(52): craft\web\View->renderPageTemplate('index', Array, 'site')
#22 /vendor/yiisoft/yii2/web/Response.php(1095): craft\web\TemplateResponseFormatter->format(Object(craft\web\Response))
#23 /vendor/craftcms/cms/src/web/Response.php(275): yii\web\Response->prepare()
#24 /vendor/yiisoft/yii2/web/Response.php(339): craft\web\Response->prepare()
#25 /vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#26 /web/index.php(22): yii\base\Application->run()
#27 /.composer/vendor/laravel/valet/server.php(234): require('/Users/admin/Va...')
#28 {main} {"memory":13815056,"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): Calling unknown method: verbb\\formie\\elements\\Form::getFields() at /templates/_snippets/_anfrage-formular.twig:69)"}
It looks like you're using custom templates? There would be a reference to getFields()
in templates/_snippets/_anfrage-formular.twig:69
?
Yes, I am using it as in your docs: https://verbb.io/craft-plugins/formie/docs/template-guides/custom-rendering
And it worked until version 1.5.x.
Ah, yes, this isn't part of the Formie templates, but example templates to get you started. This has changed in Craft (not just Formie - anything with fields). This should now be getCustomFields()
.
I've added this to the upgrade guide, but do note that there will be more template changes coming up in the beta, as we are refactoring things.
That's it! Small cause, much trouble!
Template changes? :-/
We're taking the opportunity to do some template changes to allow for better customisation, so you hopefully won't need to rely on template overrides as much, unless you want to really, really roll your own solution. Just some of the things we're addressing:
We're still working through the changes and we'll be sure to outline everything in a guide.
Thanks! Sounds interesting ...
Really looking forward to easier Tailwind support
@SanboKyo @jan-dh If you're interested, check out the proposed way we're looking to address this https://github.com/verbb/formie/issues/937
Great, thanks for the head's up!
After upgrading Craft 4 ... Formie 2 I get
Calling unknown method: verbb\formie\elements\Form::getFields()
Form settings
Please pick from the options below.
Additional info