Form-fields Tag
To be used within the form:create tag when rendering fields.
Example#
This tag can recursively loop over the fields array context provided within the form:create tag pair.
{{ form:fields }}
{{ if is_informative }}
{{ field }}
{{ else }}
<div class="p-2">
<label>{{ display }}</label>
<div class="p-1">{{ field }}</div>
{{ if error }}
<p class="text-gray-500">{{ error }}</p>
{{ /if }}
</div>
{{ /if }}
{{ /form:fields }}
<s:form:fields>
@if ($field['is_informative'])
{{ $field['field'] }}
@else
<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>
@endif
</s:form:fields>
Informative fields β like headings, banners, and paragraphs β don't collect any data, so they have no label or error of their own. The is_informative variable lets you render just their field markup and skip the surrounding label/error wrapper.
Parameters
get
string
Get and render one specific field by its handle.
only
string
Loop over only the specified field handles (pipe separated).
except
string
Loop over all except the specified field handles (pipe separated).