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.

Forms & Blueprints

Form Plugin v5.1.0 : prepare_form_fields()

form plugins

Solved by Adrian Waterhouse View solution

Started by Adrian Waterhouse 5 years ago · 5 replies · 552 views
5 years ago

Can I confirm that since v5.1.0 enforces the requirement of all fields to have a "name" field even if logically they don't require them, fields such as spacer.

I think it's in the new prepare_form_fields()

If I don't include a name field they don't render, took a while to figure out what was going on.

5 years ago

@adrianw, It sure looks like that....

classes/TwigExtensions.php: lines 83-87

PHP
/ Make sure that the field has a name.
$name = $name ?? $field['name'] ?? null;
if (!is_string($name) || $name === '') {
    return null;
}

You might consider creating an issue stating this is a breaking change.

last edited 09/13/21 by pamtbaau
5 years ago

thanks for looking at thing @pamtbaau . I will raise it, I just wanted to be sure I hadn't fallen into a different trap or was doing something wrong in the first place.

5 years ago

@adrianw, To the benefit of the community, it will be appreciated if you could share the link to the issue and report back any conclusions.

5 years ago Solution

The fix was released in v5.1.1 of the Form plugin, I've download and tested the release with the form that was problematic and everything worked as it should.

👍 1

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1136 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 134 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 129 7 months ago