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.

General

Documentation on Forms seems to be Incorrect

form

Started by Richard Hainsworth 6 years ago · 0 replies · 431 views
6 years ago

Been working on this problem of mine /forum/general/obtaining-a-form-object-for-use-in-a-twig-template-t2313

It states clearly in the main Grav documentation (see https://learn.getgrav.org/16/forms/forms#displaying-forms-from-twig) that a form can be obtained from another route with

TWIG
{% include "forms/form.html.twig" with { form: forms('contact-form') } %}

But the variable forms is not available as a Twig variable. So the code in the Documentation will not work in another Twig template or on page (I have tested this code in both a twig template and a form.md page).

Looking deeper:

The variable form is available and it is set in the plugin code (/user/plugins/form/form.php) in the function onTwigVariables, but forms is not set there.

This means that there is a disconnect between the Documentation and the implementation of the Form plugin.

If there is another way to access a form on another page, it is not documented - I think. I have been looking at this for a while, and I could have missed something.

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 80 9 hours ago
General · by pamtbaau, 14 hours ago
1 51 13 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago