Hello,
I’m trying to do exactly the same as this post:
But without success.
I’m having this twig in ckeckbox filed:
{% extends "forms/field.html.twig" %}
{% block label %}
{% endblock %}
{% block input %}
{% set id = field.id|default(field.name) ~ '-' ~ key %}
<div class="{{ form_field_wrapper_classes ?: 'form-input-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<input
{# required attribute structures #}
name="{{ (scope ~ field.name)|fieldName }}"
value="{{ value|join(', ') }}"
type="checkbox"
{% if value == true %} checked="checked" {% endif %}
{# input attribute structures #}
{% block input_attributes %}
id="{{ id|e }}"
{% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
{% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if required %}required="required"{% endif %}
{% endblock %}
/>
<label style="display:inline;" class="inline" for="{{ id|e }}">
{% if field.markdown %}
{{ field.label|t|markdown(false) }}
{% else %}
{{ field.label|t|e }}
{% endif %}
{{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
</label>
</div>
{% endblock %}
And I 've this form:
placeholder: 'Escriu el teu missatge'
type: textarea
validate:
required: true
-
name: priv
label: 'Accepta la <a target="_blank" href="avis-de-privacitat">política de privacitat</a>?'
type: checkbox
validate:
required: true
And the form shows all as string.
I’ve tried to change the twig without the |e but not working the html. And I’m aware of this post trying to do it in a markdown way:
What I must do?