You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to version 1.54.0 which included pull request 11293([5.x] Allow form fields view to be rendered with single tag) all of my forms stopped being able to render.
In my case I have followed the Blade version of the documentation from "The Template" which states you have to @foreach over the fields. However the change in this PR changes the result from an array of the form inputs to the FieldsVariable object.
My fix from the documented
// Loop through and render the form inputs
@foreach ($fields as $field)
<div class="p-2">
<label>{{ $field['display'] }}</label>
<div class="p-1">{!! $field['field'] !!}</div>
@if ($field['error'])
<p class="text-gray-500">{{ $field['error'] }}</p>
@endif
</div>
@endforeach
was to call toArray() on the $fields object
// Loop through and render the form inputs
@foreach ($fields->toArray() as $field)
<div class="p-2">
<label>{{ $field['display'] }}</label>
<div class="p-1">{!! $field['field'] !!}</div>
@if ($field['error'])
<p class="text-gray-500">{{ $field['error'] }}</p>
@endif
</div>
@endforeach
I feel like $fields->toArray() should just be a workaround as the documented version makes more sense from a Blade point of view.
How to reproduce
Create a form in the control panel, follow the documented solution to render the form using blade templates, $fields are not rendered because they are no longer an array.
Bug description
After upgrading to version
1.54.0
which included pull request 11293([5.x] Allow form fields view to be rendered with single tag) all of my forms stopped being able to render.In my case I have followed the Blade version of the documentation from "The Template" which states you have to
@foreach
over the fields. However the change in this PR changes the result from an array of the form inputs to theFieldsVariable
object.My fix from the documented
was to call
toArray()
on the$fields
objectI feel like
$fields->toArray()
should just be a workaround as the documented version makes more sense from a Blade point of view.How to reproduce
Create a form in the control panel, follow the documented solution to render the form using blade templates,
$fields
are not rendered because they are no longer an array.Logs
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
The text was updated successfully, but these errors were encountered: