diff --git a/templates/forms/fields/checkbox/checkbox.html.twig b/templates/forms/fields/checkbox/checkbox.html.twig
index ee60e71..e86b0d9 100644
--- a/templates/forms/fields/checkbox/checkbox.html.twig
+++ b/templates/forms/fields/checkbox/checkbox.html.twig
@@ -4,29 +4,35 @@
{% endblock %}
{% block input %}
- {% set id = field.id|default(field.name) ~ '-' ~ key %}
+ {% set id = field.id|default(field.name)|hyphenize %}
{% endblock %}
diff --git a/templates/forms/fields/checkboxes/checkboxes.html.twig b/templates/forms/fields/checkboxes/checkboxes.html.twig
index 8674ab8..f096cae 100644
--- a/templates/forms/fields/checkboxes/checkboxes.html.twig
+++ b/templates/forms/fields/checkboxes/checkboxes.html.twig
@@ -15,7 +15,7 @@
{% block input %}
{% for key, text in field.options %}
- {% set id = field.id|default(field.name) ~ '-' ~ key %}
+ {% set id = field.id|default(field.name)|hyphenize ~ '-' ~ key %}
{% set name = field.use == 'keys' ? key : id %}
{% set val = field.use == 'keys' ? '1' : key %}
{% set checked = (field.use == 'keys' ? value[key] : key in value) %}
@@ -27,10 +27,9 @@
id="{{ id|e }}"
value="{{ val|e }}"
name="{{ (scope ~ field.name)|fieldName ~ '[' ~ name ~ ']' }}"
+ class="{{ form_field_checkbox_classes }} {{ field.classes }}"
{% if checked %}checked="checked"{% endif %}
- {% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
-
>
{% if help %}