I'm trying to modify someone else's website setup (a Craft CMS with a Laravel plugin) but I can't decipher the syntax of this Twig form, I was hoping someone more familiar with Twig/Symfony form templating could tell me what's going on or point me to the right documentation.
Specifically, I have a variable I want to render as a placeholder in an input. So {{ myvariable }}
should be <input type="text" placeholder="{{ myvariable }}" ...
, but I'm unfamiliar with how the inputs are being rendered.
Here's what's in the Twig template:
{% include "dir/content_type/_field" with {
control: { handle: 'location_address_1', value: 'address_1'},
element: content_type,
errors: errors is defined ? errors : null
} only %}
The _field I assume is a nearby html template, which has:
{% set field = craft.fields.getFieldbyHandle(control['handle']) %}
{% set fieldtype = craft.fields.populateFieldType(field, element) %}
{% set value = element ? element[control['value']] : null %}
{% set required = required is defined ? required : false %}
{% set input = fieldtype.getInputHtml(field.handle, value) %}
{% set label = no_label is defined and no_label ? '' : field.name|t|e%}
{% set errors = errors is defined and errors[control['value']] is defined ? errors[control['value']] : null %}
{% include "_includes/forms/field" with {
label: label,
id: field.handle,
errors: errors,
input: input,
required: required
} only %}
Any insight is appreciated.