Hey guys,
I’m building a large form right now. I need to modify the checkboxes field type.
Which works fine, if I copy the folder and template file to my own theme. But I need to create a new field type, something like checkbox-images
, to also keep the original checkboxes field type.
So I copied the modified checkboxes folder with the checkboxes.html.twig
file and renamed folder and file to checkboxes-images
, then I changed the field type inside the form.md
from
wert:
type: checkboxes
display_label: false
to
wert:
type: checkboxes-image
display_label: false
The rendering of my checkbox fields frontendwise is working as aspected.
Unfortunately the selected checkboxes fields do not get rendered inside the email sent by the form. I already changed the data.html.twig
template to
{% block field_value %}
{% if field.type == 'checkboxes-images' %}
<ul>
{% set use_keys = field.use is defined and field.use == 'keys' %}
{% for key,value in form.value(scope ~ field.name) %}
{% set index = (use_keys ? key : value) %}
<li>
{{ field.options[index].name|e }}
</li>
{% endfor %}
</ul>
{% elseif field.type == 'checkbox' %}
But this does not work. At this point I’m stuck. Everything works if I change the original file, but if I copy the file and rename the `field type, the checkboxes field does not get rendered inside the email. Any help?